Hey, I need help! I made a scrolling game using the basic scrolling script that you see a lot, Now how do I create enemies that walk on their own and will shoot at you when you are within a certain range? Keep in mind that this IS a working scroller. See it at my profile. Project name: Iron Man level 1
Offline
I only know how to make enemies that don't go anywhere, like in my Skywire Scroller. Example:
<when green flag clicked>
<forever>
<set x to( (( ( [X position] of [scroll5] ) <+> 30 ))
<end>
Last edited by martianshark (2009-12-20 19:00:12)
Offline
martianshark wrote:
I only know how to make enemies that don't go anywhere, like in my Skywire Scroller. Example:
<when green flag clicked>
<forever>
<set x to( (( ( [X position] of [scroll5] ) <+> 30 ))
<end>
Love the Sky wire, and thanks, I was able to figure out that much by myself, but I need sprites that walk and shoot at you. Thanks anyway
Offline
Sorry, I don't know how to do that. Making something like that is really complicated.
Offline
My game, PikAdventure, does the above. You should be able to make an enemy that doesn't move, and be able to put it into a certain position on the screen before reading on (just add or take away a number to do this). What I did was make a new variable. This variable would change the "add or minus" number. So, instead of "adding 30" to an enemy's position, you "add variable". Now, either within the script or by making a new script (i think i made a new script), continually change this variable within the constraints you want. But wait, your not done, because the scrolling velocity is changing according to what keys the player is pressing, you must MINUS or ADD the scrolling velocity (should be a variable already). Just play around with it untill it looks better (one will look completely wrong and one will look right). This is so if the player moves left or right, the bullet doesn't seem to slow down or speed up.
That's the moving part done (if you're stuck, ask me). Now, to make the enemy shoot, follow the same sort of principle above. I always use a broadcast block to broadcast to the Bullet sprite that it needs to shoot. If you only want to shoot when the sprite is in range, just check if the distance to Player sprite is less then 100 before broadcasting, for example. When the Bullet sprite recieves the broadcast to shoot, tell it to go to the enemy. Now (bit tricky now), get it to move in a direction and remember to MINUS or TAKE the current scrolling velocity.
Have a look at the scripts in my PikAdventure game if you want.
Any problems, ask!
Offline
and i just had a look at ur scripts in your game. yeah, your using the same scrolling techniques as me, but, just a tip, try combining the terrain sprites into 2 if you can. (just think about how this would work and it should be do-able).
Offline
Dibbo222 wrote:
My game, PikAdventure, does the above. You should be able to make an enemy that doesn't move, and be able to put it into a certain position on the screen before reading on (just add or take away a number to do this). What I did was make a new variable. This variable would change the "add or minus" number. So, instead of "adding 30" to an enemy's position, you "add variable". Now, either within the script or by making a new script (i think i made a new script), continually change this variable within the constraints you want. But wait, your not done, because the scrolling velocity is changing according to what keys the player is pressing, you must MINUS or ADD the scrolling velocity (should be a variable already). Just play around with it untill it looks better (one will look completely wrong and one will look right). This is so if the player moves left or right, the bullet doesn't seem to slow down or speed up.
That's the moving part done (if you're stuck, ask me). Now, to make the enemy shoot, follow the same sort of principle above. I always use a broadcast block to broadcast to the Bullet sprite that it needs to shoot. If you only want to shoot when the sprite is in range, just check if the distance to Player sprite is less then 100 before broadcasting, for example. When the Bullet sprite recieves the broadcast to shoot, tell it to go to the enemy. Now (bit tricky now), get it to move in a direction and remember to MINUS or TAKE the current scrolling velocity.
Have a look at the scripts in my PikAdventure game if you want.
Any problems, ask!
Thanks! I will try that soon, but thanks for even playing my Iron Man game! BTW this is off topic, but did you like it?
Offline