Basic Enemy tutorial?
I'm just looking to make a basic enemy who begins walking in a random direction on spawning (up,down,left, or right) at a set speed, and every 2 seconds they change direction randomly from the 4 directions maintaining speed. They also need to stay on the screen. I was hoping the Intro tutorial would cover creating the enemies shown in the video but they did not. Thanks!
I should mention I come from more of a Game Maker background, back when it was GM 7 and they just had a drag and drop for things like "move character in this direction" as a default thing. I see something similar here but I haven't figured out how to loop the behavior of a Loop function to Move Direction - Timer 2 seconds - Move another direction, without having to set a variable somewhere... is there a way to say if the actor exists then it should follow this loop?
Comments
I suspect this not exactly what you want but it might help.....?
Random movement in four directions but not moving off screen.
https://www.dropbox.com/s/wrzl8idk7uf9rrx/random move with walls.zip?dl=0
I will check it out today, thanks!
I have done something similar except I have it currently changing a direction variable from 0 to 180 on every cycle of the timer. I see in your example you use random(1,4) which I am guessing randomly chooses an integer between 1 and 4. Is there a way to make it randomly choose 0 or 180 when it gets spawned?
You said you wanted 4 directions so yes I made an integer.
Sure you can have it start with 0 or 180. I just changed the numbers around.
So now it will start and pick a random Direction integer 1 or 2.
If it picks 1 it will go 0, If it picks 2 it will go 180. After 2 seconds it will go in any of the four directions.
https://www.dropbox.com/s/hs3gkep1zr2hboc/random move with walls 2.zip?dl=0
Makes sense, thanks for the help talking it through and showing me the ropes!