Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,227 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Please help!!! #306023
01/19/10 04:17
01/19/10 04:17
Joined: Dec 2009
Posts: 24
DirtyDhan Offline OP
Newbie
DirtyDhan  Offline OP
Newbie

Joined: Dec 2009
Posts: 24
I'm currently creating a vs game. When I run my program. It doesn't detect any error. The program suddenly wont respond.

Here are the codes.
Please help . . .

-----------------------------------------------------------
#include <acknex.h>
#include <default.c>

#define STATE skill1
#define ANIMATION skill2






function camera_follow(ENTITY* ent)
{
while(1)
{
vec_set(camera.x,vector(-950, 0, 450));
vec_rotate(camera.x,ent.pan);
vec_add(camera.x,ent.x);
vec_set(camera.pan,vector(ent.pan,-5,0));
wait(1);
}
}

action player_zuma()
{
camera_follow(me);
my.STATE = 1;
my.ANIMATION += 10 * time_step;
ent_animate(my, "idle", my.ANIMATION, ANM_CYCLE);


while (1)
{
if (key_cur - key_cul)
{
my.ANIMATION = 0;
my.STATE = 2 ;
}
if(my.STATE = 2)
{
var distance = (key_cul - key_cur)*5*time_step;
c_move(my, vector(0,distance,0), NULL, NULL);
my.ANIMATION += 2*distance;
ent_animate(my,"walk",my.ANIMATION,ANM_CYCLE);
if(!key_cur - key_cul)
{
my.ANIMATION = 0;
my.STATE = 1;
}
}



if (key_z)
{
my.ANIMATION = 0;
my.STATE = 3;
}


if (my.STATE = 3)
{
my.ANIMATION += 10 * time_step;
ent_animate(my, "firstpunch", my.ANIMATION, ANM_CYCLE);
my.STATE = 1;
}

if (my.STATE = 3)
{
my.ANIMATION = 0;
if (!key_space)
my.STATE = 1;
}




}
}

action player_cb()
{
wait (1);
}

function main()
{
level_load ("rooftop.wmb");
ent_create ("zuma.mdl", vector (-50, 0, -10), player_zuma);
}


If you do not know where you are . . .
Ask a villager.
Re: Please help!!! [Re: DirtyDhan] #306024
01/19/10 04:48
01/19/10 04:48
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Your program is caught in an infinite loop and not releasing resources to other functions etc. You need to add a 'wait(1);' at the end of the while loop in 'player_zuma'.

Re: Please help!!! [Re: DJBMASTER] #306025
01/19/10 04:51
01/19/10 04:51
Joined: Dec 2009
Posts: 24
DirtyDhan Offline OP
Newbie
DirtyDhan  Offline OP
Newbie

Joined: Dec 2009
Posts: 24
yay, tnx. im really not used to programming T,T . . .


If you do not know where you are . . .
Ask a villager.

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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