Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
HELP! Animations #248125
01/24/09 17:43
01/24/09 17:43
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
Ok, so I managed to make an modell in MED and made som bone-animations. Now I face a wall, I do not know how to implement this animation into the script. Though I know how to make gravity and such, I do not know c-move as I find the workshop a bit unfinished. Is there anyone that can help me implement the animations into the script, and make the player move with the animation?

Re: HELP! Animations [Re: Harstad] #248126
01/24/09 17:47
01/24/09 17:47
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
Here's the code so far, as you can see, I'm experimenting with c-move:
#include <acknex.h>
#include <default.c>


VECTOR Player1_speed;
ENTITY* Player1;


BMAP* mouse_point = "mouse_pointer.bmp";
BMAP* new_panel_1 = "panel_1.bmp";
BMAP* main_menu = "main_menu.bmp";


PANEL* new_panel =
{
pos_x = -5;
pos_y = 400;
layer = 1;
bmap = new_panel_1;
button (10,10, "Exit_button.bmp", "Exit_button_checked.bmp", "Exit_button.bmp",quit_program, NULL, NULL);
flags = OVERLAY | VISIBLE;
}

function mouse_toggle()
{
mouse_map = mouse_point;
mouse_mode = 1;
while (1)
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait (1);
}
}

function quit_program()
{
sys_exit (NULL);
}



function main()
{
video_mode = 7;
video_screen = 1;
level_load ("Test_map_1.wmb");
wait (2);
Player1 = ent_create ("Person.mdl", vector(-500, -100, 0), NULL);
ph_setgravity (vector(0, 0, -200));
phent_settype (Player1, PH_RIGID, PH_BOX);
phent_setmass (Player1,3, PH_BOX);
phent_setfriction (Player1, 80);
phent_setdamping (Player1, 40, 40);
phent_setelasticity (Player1, 50, 20);
while (1)
{
camera.x = Player1.x -200;
camera.y = Player1.y;
camera.z = Player1.z+50 ;
on_m = mouse_toggle;
on_q = quit_program;
wait(1);
}
}

action move_me()
{
while (key_w)
{
c_move (Player1, nullvector, vector(0, 0, 50*time_step), GLIDE);
wait (1);
}
}



Last edited by Harstad; 01/24/09 17:48.
Re: HELP! Animations [Re: Harstad] #248137
01/24/09 19:38
01/24/09 19:38
Joined: Apr 2005
Posts: 69
G
Goodberry Offline
Junior Member
Goodberry  Offline
Junior Member
G

Joined: Apr 2005
Posts: 69
Hey,

If you are using physics on your player model you can't play animations on it. In order to move your character while playing a walkcycle (is that what you ar trying to do?) you would play the animation on the character and move him forward with c-move.

To do this you need to run a script on your character which updates the animation every frame. So instead of

Player1 = ent_create ("Person.mdl", vector(-500, -100, 0), NULL);

write

Player1 = ent_create ("Person.mdl", vector(-500, -100, 0), playerscript);

and then make the function playerscript like so:

void playerscript
{

var anim_percentage = 0;

while(1)
{
anim_percentage += 2 * time_step;
ent_animate(me, "walk", anim_percentage, ANM_CYCLE);
c_move (Player1, nullvector, vector(0, 0, 50*time_step), GLIDE);

}

}

You should also look up the documentation for c_move in the manual, it has a complete script for moving a character.

Re: HELP! Animations [Re: Goodberry] #248157
01/24/09 23:16
01/24/09 23:16
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
I gone through it in parts, whenever I need something, I check with it first.
I'm getting confused by the "walk" in ent_animate(me, "walk", anim_percentage, ANM_CYCLE); what does it refer too?

for MED, its enough to make the animations, and then just use ent_create and then ent_animate to get him to do the animation?

Re: HELP! Animations [Re: Harstad] #248194
01/25/09 09:15
01/25/09 09:15
Joined: Oct 2008
Posts: 67
C
Crypton Offline
Junior Member
Crypton  Offline
Junior Member
C

Joined: Oct 2008
Posts: 67
if you would look up in the manual:

ent_animate(ENTITY* entity,STRING* scene,var percent,var mode)

String* scene reffers to the name of your scene.
If you create frames in MED you can name them. Such as walk1 walk2 walk3 etc.
That name without number is the scene string you have to use between quotes (as string is defined)
For bones I'm not sure. In manual, it says kinda that you should use ANM_ADD to add animations from precalled ent_anim functions. I think in some AUM there was a tutorial about this....? Just remeber I saw one somewhere.

Cheers!


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: HELP! Animations [Re: Crypton] #248206
01/25/09 10:56
01/25/09 10:56
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
ok, thanks that answers my question;)

Re: HELP! Animations [Re: Harstad] #248415
01/26/09 19:17
01/26/09 19:17
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
Ok, so I managed to get the animations in and stuff, but I wonder, how do I get it so that when I hit w, he walks forward, but when I release it he gets to an halt with and blends into the idle animation?

function playerscript()
{
while(!key_w) wait(1);
while(1)
{
ent_animate(me, "walk", anim_percentage, ANM_CYCLE); //animates the player
anim_percentage += 10*time_step; // set the animation in motion
c_move(me,vector(10*time_step,0, 0), nullvector, GLIDE); //sets the player in movement
wait (1);
}
}


Last edited by Harstad; 01/26/09 19:20.
Re: HELP! Animations [Re: Harstad] #248425
01/26/09 20:09
01/26/09 20:09
Joined: Oct 2008
Posts: 67
C
Crypton Offline
Junior Member
Crypton  Offline
Junior Member
C

Joined: Oct 2008
Posts: 67
I'd do:
//Attach it inside WED to an object:
Code:
action playerscript()
{

while(1)
{
   if (key_w)
   {
   anim_percentage += (10*time_step)%100; //%100 keeps it inside 100 value
   ent_animate(me, "walk", anim_percentage, ANM_CYCLE); //animates the player
   }else{ //If no button, do the idle or stand or whatever:
   idle_precentage += (5*time_step)%100; //declare a second percentage variable for this!
   ent_animate(me, "idle", idle_percentage, ANM_CYCLE); //animates the player
   }
c_move(me,vector(10*time_step,0, 0), nullvector, GLIDE); //sets the player in movement

wait (1);
}
}


for movement I'd do a speed variable and make it's value according to buttons:

spdx = (key_w - key_a)*10*time_step;

The idea is that when you press W you get (1-0)*10*time_step which is like 10*timestep. Positive value to move forward. And when A is pressed you get
(0-1)*10*time which is -10*time_step a negative value to go backward f.i.
And then use it inside "relvector" x component in c_move.
Just go and search for tutorials. Such tricks and hints are covered there.

Cheers!


New into Gamestudio and eager to learn it..
Stuff and games done in 2D: LINK
Re: HELP! Animations [Re: Crypton] #248563
01/27/09 18:06
01/27/09 18:06
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
thanks, it helped alot:D every help I get brings me one step closer to my game;)


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1