P
Power_Michael
Guest
Hey everyone, I currently need help with "changing an object's sprite with an Alarm". But to make things trickier, I need the alarm (or several alarms) to change the sprite of the same object several times....about 4 times. Think of a tree...it starts as a little spr_sapling....then alarm 0 changes it to spr_smallTree....then what? I have a general understanding of GML...but alarms are not my best friend so if anyone has a solution to making multiple sprite changes to a single object with alarms....that would be great...and below I will put some other solutions I thought of as well as the MUCH NEEDED source code so you guys can see what I am dealing with.
Other solution (OBJECTS OVER ALARMS?): I want to make a tree grow from a sapling to a big tree...and I have 4 stages, or 4 sprites. So I thought...I could just make the sapling have an alarm that counts down and makes it turn into stage 2...or sprite 2. A bigger tree...and so on...but because I am awful with alarms I was thinking how about I just make it change OBJECT! I have done this thing before...but while I do think there are better ways doing this...like with alarms...the idea of just making the object change to another object with the next sprite...and then that object changes into the next object and so on...
Before the code is displayed, just note I already have one successful sprite change. The problem is....or what I think i need to do...is after one alarm...not only does the sprite change, but the alarm triggers another alarm...if that is possible....let me know...here is the code:
Step Event
Alarm[0]
That is all...if you want me to interpret something better or have any more questions for me, just comment below...Thank you so much!
-Michael
Other solution (OBJECTS OVER ALARMS?): I want to make a tree grow from a sapling to a big tree...and I have 4 stages, or 4 sprites. So I thought...I could just make the sapling have an alarm that counts down and makes it turn into stage 2...or sprite 2. A bigger tree...and so on...but because I am awful with alarms I was thinking how about I just make it change OBJECT! I have done this thing before...but while I do think there are better ways doing this...like with alarms...the idea of just making the object change to another object with the next sprite...and then that object changes into the next object and so on...
Before the code is displayed, just note I already have one successful sprite change. The problem is....or what I think i need to do...is after one alarm...not only does the sprite change, but the alarm triggers another alarm...if that is possible....let me know...here is the code:
Code:
For the Create event:
I have a drag and drop "alarm[0]" action...it takes 1000 steps....this is the only drag and drop I have...so moving on
Step Event
Code:
if(alarm[0] == -1) {
alarm[0] = room_speed*10;
}
Code:
if(alarm[0] == -1) {
alarm[0] = room_speed*50;
}
with(obj_player)
{
sprite_index = spr_smallTree;
}
alarm[0] = -2;
if alarm[0] = -2
{
}
That is all...if you want me to interpret something better or have any more questions for me, just comment below...Thank you so much!
-Michael