Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,758 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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