So far I have figured out so that the enemy is destroyed by my bullets, but how do I do it so that the enemy has some sort of pre-defined movement, e.g. move left and right by 5px or something constantly/looping? Do I use an instance variable like I did with the health? Any example code / project file would be much appreciated!!!!
For constant looping movement you can try addingthe sine behaviour to your enemy. It really helps me with those repetitive loops. You can pre set it and even turn it on and off with the events. Changing and playing with the different parameters will get you interesting ressults.
Any chance you can show me a working example, screenshot or something? I am still learning, I can't visualise what you are telling me?
I just tried sine, problem is although that makes them go left to right, I need some of them to go up and down? How would I change how different entities are moving, at the moment they go through solid walls?
SomeT Just made you small example of what you can do with it. The rest is up to your imagination.
You can change the sine movement and what it affects in the events.
[updte] - I modified the version so that the enemy stops on hitting the ground to address your other question on solid objects.
Develop games in your browser. Powerful, performant & highly capable.
Many thanks will check it out later!
Checked it out, I although your project is nothing like mine from looking through your code figured out what I was doing wrong on mine.
Yeah this is just a sample project to just test out the basics. I am glad it helped you a bit though.