Lives
#1
Posted 30 November 2011 - 05:07 PM
___________________________________________
ERROR in
action number 1
of Step Event
for object obj_ship_parent:
Error in code at line 1:
can_shoot += 1
^
at position 1: Unknown variable can_shoot
why is it giving me this? before i add the lives its fine, then after, its gives me this.
this is the tutorial http://www.youtube.c...h?v=qDrariGknIg
if one of you can explain, or maybe fix this problem, i welcome it, i don't mind D&D or script, but i just want it to work right
#2
Posted 30 November 2011 - 05:16 PM
The clue is in the error message.
The Step Event does not know what can_shoot is so cannot add 1 to it.
#3
Posted 30 November 2011 - 06:14 PM
In the Create Event for object obj_ship_parent you need to give the variable can_shoot a starting value.
The clue is in the error message.
The Step Event does not know what can_shoot is so cannot add 1 to it.
so what do i need to do? make a create event with the can_shoot with the starting value of 0? :S
#4
Posted 30 November 2011 - 06:24 PM
In the Create Event for object obj_ship_parent you need to give the variable can_shoot a starting value.
That should do quite nicely.
#5
Posted 30 November 2011 - 06:36 PM
In the create event of your parent object , set 'can_shoot' to be true (so you can shoot). It's pretty much the same as Noele posted but I don't know why you have can_shoot += 1
OR
Why not just set it to can_shoot = 1; ?
#6
Posted 30 November 2011 - 06:50 PM
Assuming that "can_shoot" is either a 1 for shooting and a 0 for not shooting, it would be easier to set it as a Boolean variable (true/false).
In the create event of your parent object , set 'can_shoot' to be true (so you can shoot). It's pretty much the same as Noele posted but I don't know why you have can_shoot += 1
OR
Why not just set it to can_shoot = 1; ?
i have done it with a = 1, i dont actually know where the + has come from. cus without the lives system in there the game works perfectly fine, then i add the lives and it comes up with this error. now i've tried 4 different tutorials and it happens everytime. then i exit game maker and return to the previous save and it works. :@ how is the lives making it f***ed up??
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











