Object created every second
#1
Posted 03 June 2012 - 10:29 AM
I already have the enemy script and the bullet-damage script.
Please help
Thanks :D
#2
Posted 03 June 2012 - 10:35 AM
In the create event, use "Set Alarm" in the main2 tab set an alarm (alarm0) to 30.
Add an "Alarm 0" event and in it, make the enemy fire a bullet and again set alarm0 to 30.
That setup makes the enemy have a 1 second timer that fires the bullet and resets the timer to 1 second so it will continue firing.
If you don't know why I chose 30, in the "Settings" tab in your room, you will see that "Speed" is set to 30. That means 30 frames per second. Alarms use frames.
#3
Posted 03 June 2012 - 10:43 AM
create event - set alarm[0] to 30 (main2 tab)
alarm[0] event - instance create, obj_enemy.x, obj_enemy.y, obj_bullet (main1 tab). Set alarm[0] to 30 (main2 tab).
obj_bullet
create event - Put here what you want the bullet to do. If you want it to shoot in a random direction, add: move towards point, random(360), random(360), 3 (move tab). You can change the 3 to anything you want, this is the speed of the bullet.
The names of the objects may differ, so just change them as required.
#4
Posted 03 June 2012 - 10:46 AM
To make things happen on regular intervals, alarms are a good idea.
In the create event, use "Set Alarm" in the main2 tab set an alarm (alarm0) to 30.
Add an "Alarm 0" event and in it, make the enemy fire a bullet and again set alarm0 to 30.
That setup makes the enemy have a 1 second timer that fires the bullet and resets the timer to 1 second so it will continue firing.
If you don't know why I chose 30, in the "Settings" tab in your room, you will see that "Speed" is set to 30. That means 30 frames per second. Alarms use frames.
Is this right? please tell me if im wrong :S
http://i1081.photobucket.com/albums/j360/naseem142/sarggggggggggg.png
#5
Posted 03 June 2012 - 11:00 AM
yes but if you have many different room_speeds(and don't bother doing the math) use room_speed* seconds to get the desired number of seconds without doing the math.
To make things happen on regular intervals, alarms are a good idea.
In the create event, use "Set Alarm" in the main2 tab set an alarm (alarm0) to 30.
Add an "Alarm 0" event and in it, make the enemy fire a bullet and again set alarm0 to 30.
That setup makes the enemy have a 1 second timer that fires the bullet and resets the timer to 1 second so it will continue firing.
If you don't know why I chose 30, in the "Settings" tab in your room, you will see that "Speed" is set to 30. That means 30 frames per second. Alarms use frames.
Is this right? please tell me if im wrong :S
http://i1081.photobu...ggggggggggg.png
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











