• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

GML Need help with game coding [Solved]

G

Gustavo Miler

Guest
So, i need help with some coding, i've been trying to make an moomoo.io like game, so the Hatchet or Axe animation is kinda hard, i tried everything, here's the code:
Code:
//Object Axe

//Create Event
image_speed = 0;

//Global left button Event
image_speed = 3;
alarm[0] = 90;

//Alarm 0 Event
image_speed = 0;
image_index = 1;
Please help, i will read this thread tomorrow, as i have to go to school early, thanks in advance

btw, sorry for the bad english q.q
 

2Dcube

Member
So, what is the actual problem?
Just looking at the code, I can't tell if there is something wrong.
 
E

Eyecatch

Guest
@Gustavo Miler So.. you wanna get the Axe animate as you click, then it's stop when the animation end? Maybe something like this:
Code:
//Object Axe

//Create Event
image_speed = 0;
image_index = 1;

//Global left button Event
if(image_index = 1) image_speed = 1;

//Step Event
if(image_index = image_number)
{
 image_speed = 0;
 image_index = 1;
}
What happen in the step event you could also try to put that in the Animation End event, there's an event named like that.
EDITED: But without the if(..
 

Fabseven

Member
Like said eyecatch, you can work on the image_index, if you are on the last sprite then you do something.
For example, in a obj_explosion i got a sprite with 52 frames , at frame 52 i destroy the object.
If Think there is a event "animation end" you could use for that.
 
G

Gustavo Miler

Guest
@Gustavo Miler So.. you wanna get the Axe animate as you click, then it's stop when the animation end? Maybe something like this:
Code:
//Object Axe

//Create Event
image_speed = 0;
image_index = 1;

//Global left button Event
if(image_index = 1) image_speed = 1;

//Step Event
if(image_index = image_number)
{
 image_speed = 0;
 image_index = 1;
}
What happen in the step event you could also try to put that in the Animation End event, there's an event named like that.
EDITED: But without the if(..
Thanks! It worked very well, i used the end animation event. Thanks to everyone, i'll close this thread as solved(i think there's an option with that)
 

Joe Ellis

Member
one side tip, think past the built in variables, you can do so many things with custom variables, even building a 3d game engine (lol, I'm not actually advertising my program, really. I dont care about making money, but I have worked for 2 years on it, so $3 an hour * 3120 = $9360) but the program is only $25.00, I know yoyo wont delete this comment cus it could potentially make them millions
I am a bad ass
 
Top