Thank you for this great code sample @ThinBuffalo !
I’m testing code for a game (before adding graphics) and just tried this code sample you shared, and although it mostly works (which is awesome btw!), I’m having a problem and I’d love your help! I used the first approach you shared (as I do not want the zombie to rotate, which occurs in your second approach).
The zombie (in this case a robot) is activated by a switch on the floor (a black flower icon in this demo, which opens a door). This makes the robot move, but this robot reappears in the bottom left corner (with the code you shared) and not in its original position. The robot only seems to move up and to the right, but not down or to the left.
Click here for a sample video of the code in action.
1) How can I get the robot to also chase the hero down or to the left?
2) Also how do I set the initial position the robot will move from, while still being able to be activated from its resting position (activated by a variable called ‘Switch’ being equal to the value of ‘1’ when the flower is bumped)?
FYI I coded the robot to bounce off the walls. The goal is for the monsters to be activated once rooms are opened and collide with walls in an effort to chase the hero (and once in contact with the hero, applying damage to the hero).
I’ve got it all working in concept, except for fixing the robot so that it also moves down and to the left, from its original standby position, and only once activated by the floor switch. I’m stumped!
Thanks in advance for your help!
P.S. Here is an example image of the code I have setup for question #2, for the switch activating the robot, and trying to put it in the correct position before it moves.