animation

Non-platform specific questions.

animation

Postby praaab » Mon Jul 04, 2011 3:02 am

ok so im creating a game where a guy hits a block and the mushrrom pops out, u get the mushroom and he turns into a different animation like a bigger person like mario and i dont understand how to do it,
my animation names r BIG_walk right 01. BIG_walk left 02. BIG_jumping left. BIG_jumping right. BIG_stay right. BIG_stay left. <- r the animations of when he hits the mushroom and get bigger
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: animation

Postby skydereign » Mon Jul 04, 2011 10:35 am

Well you'll need to have a variable to tell the player that it is in "big" state. That way when you have other events that call ChangeAnimation, they can change the animation properly (so move right, or big move right). Here are some possible methods. One you can have in the collision with the mushroom a variable flipped, and use a switch whenever you have an animation call.
player -> Collision with mushroom -> Script Editor
Code: Select all
powered=1;


player -> Any event that would change the animation -> Script Editor
Code: Select all
switch(powered)
{
    case 0:
    ChangeAnimation("Event Actor", "move_right", NO_CHANGE);
    break;

    case 1:
    ChangeAnimation("Event Actor", "big_move_right", NO_CHANGE);
    break;
}


You could also make the animations ordered symmetrically, so you can use this. STAND would be a definition probably set to 0 (to show the animindex of the stand animation). powered is the same variable as above. The 6 is signifying that there are 6 animations for the player, 0-5 are the small ones, making 6-11 the big ones.
Code: Select all
 ChangeAnimation("Event Actor", getAnimName(STAND+powered*6), NO_CHANGE);


You could also use a different actor that uses inheritance to have all of the player's abilities but have different animations. Thinking about it this is the simplest method (depending on how you do view control). All you need to do is make sure the small player is destroyed and you create the big one in the same spot.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: animation

Postby praaab » Mon Jul 04, 2011 2:54 pm

well i have this: char*key=GetKeyState();

if(right==1)
{
if(key[KEY_RIGHT]==1&&key[KEY_LEFT]==0)
{
ChangeAnimation("Event Actor", "BIG_walk right 01", FORWARD);
}

if(key[KEY_RIGHT]==0&&key[KEY_LEFT]==0)
{
ChangeAnimation("Event Actor", "BIG_stay right", FORWARD);
}
}


if(right==0)
{
if(key[KEY_RIGHT]==0&&key[KEY_LEFT]==1)
{
ChangeAnimation("Event Actor", "BIG_walk left 01", FORWARD);
}

if(key[KEY_RIGHT]==0&&key[KEY_LEFT]==0)
{
ChangeAnimation("Event Actor", "BIG_stay left", FORWARD);
}
}
but i want the character to move by the buttons on the screen. and i need jump animation
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: animation

Postby savvy » Mon Jul 04, 2011 3:34 pm

use a variable instead of OR as well as the char* key = GetKeyState(); that way its PC and ipod or whatever usable.
in order to add a jump you need to integrate the jump variable and restrict it so...
Code: Select all
if(key[KEY_UP]==1||variable==1)
{
if(jump==1)
{
yvelocity=-8;
jump=0;
}
}

also, with your current animation change you have it so it would change to frame 0 repeatedly, try using an animindex restricter.
Code: Select all
if(animindex!=1)ChangeAnimation("Event Actor", "BIG_stay left", FORWARD);


:) savvy
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: animation

Postby praaab » Mon Jul 04, 2011 4:49 pm

ok well i have on the screen buttons to make him move so how do i replace the keys with on screen buttons can u give me a code for that?
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score

Re: animation

Postby savvy » Mon Jul 04, 2011 6:30 pm

when you click one of the on-screen buttons (mouse down event) it makes say...
Code: Select all
movement=1;


this movement of 1 makes in turn the player move left..
Code: Select all
if(movement==1)
{
x-=5;
}
if(movement==2)
{
x+=5;
}

then if you want jump, have another variable which changes on another button...
mouse down
Code: Select all
tojump=1;

draw actor
Code: Select all
if(tojump==1&&jump>0)
{
yvelocity=-8;
jump=0;
}


this answer?
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: animation

Postby praaab » Mon Jul 04, 2011 7:19 pm

man i need some live help like do u have team viewer that we can use?
praaab
 
Posts: 82
Joined: Sat Jun 18, 2011 2:14 pm
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest