Page 2 of 3

Re: Animation with gamemaker?

Posted: Thu Jul 02, 2009 7:47 pm
by Jesusfreak
Ok, thanks. I made my official noob label like Noctrine suggested by the way, is this what you had in mind? :lol:

EDIT: Didn't work. It wouldn't go left, the animation didn't go, and intstead of moving the object, it created a bunch of new ones wherever the original went. I'ma go look at the wiki and see what the codes I'm using actually mean...
if (sprite_index == spr_canonleft1)
{
with (instance_create(x,y, obj_canon))
{
direction = 180;
speed = 4;
}
}
if (sprite_index == spr_canon)
{
with (instance_create(x,y, obj_canon))
{
direction = 0;
speed = 4;
}
}
if (sprite_index == spr_canonleft2)
{
with (instance_create(x,y, obj_canon))
{
direction = 180;
speed = 4;
}
}
if (sprite_index == spr_canon2)
{
with (instance_create(x,y, obj_canon))
{
direction = 0;
speed = 4;
}
}
EDIT2: Ah, I see it, the "instance_create" code creates a new instance, what I need is the code for changing the sprite. Lemme see if I can find that...

Re: Animation with gamemaker?

Posted: Thu Jul 02, 2009 8:34 pm
by hallsofvallhalla
the code still works great, test out my gamemaker game i made in the project show off topic named fantasy heroes, i used this same code.

just take out the instance create
if (sprite_index == spr_canonleft1)
{
direction = 180;
speed = 4;
}

if (sprite_index == spr_canon)
{
direction = 0;
speed = 4;
}
if (sprite_index == spr_canonleft2)
{
direction = 180;
speed = 4;
}
if (sprite_index == spr_canon2)
{
direction = 0;
speed = 4;
}
and you must make a sprite change with the direction action...

so if keyboard = left change sprite to left_sprite

Re: Animation with gamemaker?

Posted: Thu Jul 02, 2009 8:52 pm
by Jesusfreak
Well, the canon moves properly now, but the animation still doesn't work o_O.

Does it matter that my character is a canon with spinning wheels rather than a guy walking?

The way I have my sprites is that each direction has 3 versions, each with the wheels slightly different, and it cycles through the sprites as it moves. Or, well, it's supposed to :) .

EDIT: Maybe it'd help if I actually knew what this code was doing...
The code essentially says, "If the sprite is such and such, then move at speed 4 in a certain direction," right?

Re: Animation with gamemaker?

Posted: Thu Jul 02, 2009 9:01 pm
by hallsofvallhalla
so you have a action with each arrow key press right?

with that action is a sprite change, that is the index mentioned above,

Re: Animation with gamemaker?

Posted: Wed Jul 08, 2009 4:56 pm
by Jesusfreak
(I would have responded a few days ago but I decided not to bother you guys for a while)

It didn't work. The character only moves right and the animation doesn't occur.

How do I upload the file so you can see what I did wrong?

Re: Animation with gamemaker?

Posted: Wed Jul 08, 2009 5:54 pm
by Sakar
Upload the gmk file to something like File-Pasta and give us a link.

Re: Animation with gamemaker?

Posted: Wed Jul 08, 2009 8:15 pm
by Jesusfreak
http://file-pasta.com/home/jesusfreak/#1

Does it work?

(It might be a while before I respond, my head hurts... been reading too much... :roll: )

Re: Animation with gamemaker?

Posted: Mon Jul 13, 2009 6:55 am
by Warriorccc0
Whats wrong with just using the moving, and changing sprite action?

Re: Animation with gamemaker?

Posted: Mon Jul 13, 2009 10:46 pm
by Jesusfreak
I haven't the slightest clue... it'd be easier to answer if I knew what the code Halls gave me actually did :lol: .

What is the code necessary for, Halls?

Re: Animation with gamemaker?

Posted: Tue Jul 14, 2009 12:26 am
by hallsofvallhalla
it moves the character...........