p2.lua 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. p2 = {
  2. -- Pushed values to this object on update (self.xxx)
  3. -- x,y (in) : top left corner of the entity
  4. -- vx,vy (in) : Velocity
  5. -- width (in), height : dimensions of the map<->entity hitbox
  6. -- points (in) : scored points
  7. -- intent (in-out) : Intended direction of the entity when it'll can.
  8. -- Editing intent will impact the AI's deplacement.
  9. -- The game structure
  10. -- The map is stored as 8*8pixel tiles.
  11. -- The map has a dimension of 224*248 pixels (borders included).
  12. -- To push the IA to move to another direction when it can, edit self.
  13. -- The game structure stores the players' and ghosts' position (in pixel) and velocity
  14. -- gamestructure.p1.x
  15. -- gamestructure.p2.y
  16. -- gamestructure.blinky == red
  17. -- gamestructure.inky == cyan
  18. -- gamestructure.pinky == huh
  19. -- gamestructure.clyde == orange
  20. -- gamestate functions
  21. -- Note : All of those functions needs gamestate.data as first argument
  22. -- collide(gamestate.data, x,y,w,h) checks if a rectangle defined by its left corner and its dimensions collides with the walls.
  23. -- get_gum(gamestate.data, x, y) returns the gum if there is one at this position. Gets pixel coordinates (not tile position)
  24. init = function(self)
  25. end,
  26. update = function(self)
  27. self.intent = math.random(0, 4)
  28. -- print("p1.x : "..gamestate.p1.x)
  29. end
  30. }