i am making a scrolling platformer/shooter and i need help getting the enemy to shoot bullets.
here are the scripts i use for the enemy to move.
Offline
Well...Do you understand trig, or not? I can answer after you say.
Offline
My question: What will be the trigger for your enemy to shoot? What I see is movement but nothing as an event trigger. Will it be something random? Will it be an object interaction? (such as the enemy sees your player object at x,y position) Will the enemy be efficient at targeting? (It knows where you are and can aim well) Or does it shoot towards you but may not be able to aim well? Do you plan on using real world physics? (Gravity, velocity, distance, resistance, factor x, factor y, factor z,.....)
These questions are important to how you code.
Offline
TinkerZone wrote:
My question: What will be the trigger for your enemy to shoot? What I see is movement but nothing as an event trigger. Will it be something random? Will it be an object interaction? (such as the enemy sees your player object at x,y position) Will the enemy be efficient at targeting? (It knows where you are and can aim well) Or does it shoot towards you but may not be able to aim well? Do you plan on using real world physics? (Gravity, velocity, distance, resistance, factor x, factor y, factor z,.....)
These questions are important to how you code.
i want the bullet to be able to go to the enemy's scrollx position and make the bullet scroll forward. when the enemy is visible the bullet should appear on the enemy and scroll to the left until it reachs the edge and disappears. i also want to make diffrent enemies do diffrent things such as an enemy that drops a bomb and an enemy that shoots diagonally.
i was also planning on making the main player be able to jump like mario (press key to make the player jump. if holding key, make player jump higher) but i dont know how that will work.
Offline
First; script the bullets to go the your desired X,Y positions relative to the enemy and hide. The X,Y position must remain with the enemy, so if the enemy moves the script needs to change the position accordingly.
At the beginning of your game(or current scene) broadcast a message to set the bullet in its starting position.
When Green flag is pressed
broadcast setupBullet
When setupBullet is received
set var shooter to 0
Hide
repeat until shooter = 1
go to X position of enemy, Y position of enemy
At the moment you want the bullet to shoot broadcast a message to the bullet. When the message is received, make the bullet visible, and change the position of it until it leaves the stage.
Something like:
When 'shoot' received,
set shooter to 1
show,
repeat until x <= -240
move -10 steps (change this for desired speed)
hide
set shooter to 0
broadcast setupBullet (this places the bullet into its ready position to use again.
I hope this helps. And is understandable.
If you need more help you could always email me: info (at) tinkerzone (dot) org
I am always willing to help.
Offline
TinkerZone wrote:
First; script the bullets to go the your desired X,Y positions relative to the enemy and hide. The X,Y position must remain with the enemy, so if the enemy moves the script needs to change the position accordingly.
At the beginning of your game(or current scene) broadcast a message to set the bullet in its starting position.
When Green flag is pressed
broadcast setupBullet
When setupBullet is received
set var shooter to 0
Hide
repeat until shooter = 1
go to X position of enemy, Y position of enemy
At the moment you want the bullet to shoot broadcast a message to the bullet. When the message is received, make the bullet visible, and change the position of it until it leaves the stage.
Something like:
When 'shoot' received,
set shooter to 1
show,
repeat until x <= -240
move -10 steps (change this for desired speed)
hide
set shooter to 0
broadcast setupBullet (this places the bullet into its ready position to use again.
I hope this helps. And is understandable.
If you need more help you could always email me: info (at) tinkerzone (dot) org
I am always willing to help.
ok. i found a diffrent way for the bullet to work.
when the enemy is visible and broadcasts the bullet to shoot, the bullet will appear in the enemy's position and it will go to the left until it touches the left side.
the characters scrolling speed is 5. so if the player is running left while the bullet is going forward, the bullet will go the opposite direction the player is going by 5. so the bullet will go slower which makes its current x speed 2.
if the player is running right, the bullet will go faster.
if the player is not moving. the bullet goes into its normal speed.
that way the player will be able to dodge the bullets easily.
but thanks anyway for the the help.
Offline
i do mean that these were helpful in making my own game
YAY!!! First post as a Scratcher not New Scratcher !!!YAY
Offline