|
hspeed |
|
Drag & Drop equivalent:
Reverse hspeed - D&D equivalent:
Example:
hspeed holds the horizontal speed of the object. A plus number (as in the example above) means the object is moving right, a minus number (hspeed = - 4) means the object is moving left. This is useful if you want an object with one image that you want to turn left and right (to save filesize), like an enemy on a platform game that moves left & right, you can check the hspeed of the object, if it's less that 0, it's moving left, if it's greater than 0, it's moving right.
You can also use hspeed to reverse an objects horizontal motion. For example, putting the following code inside an enemies collision with something:
Revision #3 |