Objects - Creation, Movement & Collision
Objects = templates (or blueprints) for instances (i.e. repeated spawns)
Create new object
- visible - hidden objects will not run draw events
- solid - objects that dont move (walls etc)
- depth - z axis, negative closer to you, positive into the computer screen. wont affect collision detection. good for walking behind or in front of stuff (trees, buildings etc)
- persistent - exists between rooms
- events - "discreet moments in the game loop where things are made to happen based on what you have programmed for them" (source: GM site)
- actions - "simple commands and functions to manipulate your game world" (source: GM site)
Movement
- keypress - as in once, doesnt matter if you hold it
- Keyboard - while the key is down
- keyrelease - when you let go - good for stop animations
- mouse - same deal, but you have to click on the object.. otherwise use global mouse
- movement - direction and speed, can be fixed e.g. 4, or relative i.e. based on its current speed, e.g. +0.1 or -2
Create
when object is instantiated (i.e. spawned), for example centering my object in the middle of the room:Collision
when one object touches another - for example, stopping when i hit a wall:Step
a loop that runs constantly (every step or moment), good for checking health (for example). note the chase action in the following step event picture, using the x and y position of my hero for the enemy to chase:Challenges
- Add a human object that i can best control with my arrow keys
- Add a vehicle object that uses relative speed that i can control with my WASD keys
- Add a collision detection with walls for both objects, so that both objects stop at barriers