Ok so i am new to game studio and i decided after reading the
tut i should start off with something simple. So i decided to
make a simple game were you simply attack a target and it dies,
so i decided to start off with making a little script that when
the character runs into another the character hit dies. My only
problem is when i run into him i have to keep running into him
for him to complete his death animation or it just stops.
Here is the script:
///////////////////////////////
#include <acknex.h>
#include <default.c>
///////////////////////////////
var walk_percentage;
var death_percentage;
ENTITY* gurad1;
ENTITY* guard2;
var health;
function main()
{
video_mode = 7;
level_load ("work21.wmb");
wait (2); // wait until the level is loaded
camera.z = 120; // choose a convenient height
camera.tilt = -15; // and tilt angle for the camera
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function bounce_event()
{
if (event_type == EVENT_IMPACT)
{
// play a different sound
ent_animate(guard2, "death", death_percentage, 0); // "death" one-shot animation
death_percentage += 3 * time_step; // 2 = animation speed for "death"
wait (1);
return;
}
}
///////////////////////////////
action Kill_guard()
{
my.emask |= ENABLE_IMPACT;
my.event = bounce_event;
while(1)
{
if (key_w)
c_move (my, vector(15 * time_step, 0, 0), nullvector, GLIDE);
wait(1);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
action dead_guard()
{
guard2 = my;
my.emask |= ENABLE_IMPACT;
my.event = bounce_event;
}
I couldn't figure out why i have to hold w when i run into
him for him to complete his animation i thought he would just
run the animation once he is hit but i gues it doesn't.
Does any1 have an idea why? Or have a solution i would be so
great full.