Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ozgur), 1,415 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 1
Animations locked up #180554
01/28/08 21:00
01/28/08 21:00
Joined: May 2006
Posts: 27
B
BrockA Offline OP
Newbie
BrockA  Offline OP
Newbie
B

Joined: May 2006
Posts: 27
I was getting a "possible endless loop" error in my function, so i added a wait to it.. It fixed the problem but now the animations don't work... whats wrong with the code?

Code:
 // FPSP1.wdl

// Define Variables
var video_depth 16;
var video_mode 7;
var video_screen 1;
var move_vec[3] = 0,0,0;
var stand_percent = 0;
var walk_percent = 0;
var stoptilt = 0;
// Define STRINGs, BMAPs, SOUNDS,
STRING FPSP1_str = <FPSP1.wmb>;
BMAP crosshair_pcx = <"crosshair.pcx">;
///////////////

// Mouse Function

function mouse_mapping()
{
mouse_map = crosshair_pcx;
mouse_mode = 1;
mouse_sync = ON;
}

// Action player_move

action player_move
{
player = me;
wait(1);
while(player !=NULL)
{
//Movement
move_vec[0] = (key_w - key_s) * 4*TIME;
move_vec[1] = (key_a - key_d) *4 *time;
ent_move(move_vec,NULLVECTOR);
// Camera Positions
mouse_pos.x = mouse_pointer.x;
mouse_pos.y = mouse_pointer.y;
camera.tilt += mouse_force.y;
camera.pan -= mouse_force.x;
my.pan -= 5 * mouse_force.x * time;
stoptilt += 5 * mouse_force.y *time;
camera.pan = my.pan;
vec_set(camera.x,player.x);
camera.z = player.z + 27;
camera.arc = 80;
wait(1);
}
// Animations set
if(move_vec[0] == 0 && move_vec[1] == 0)
{
stand_percent = (stand_percent +5*TIME)%100;
ent_animate(me,"stand",stand_percent,ANM_CYCLE);

}
else
{
walk_percent = (walk_percent + sign(move_vec[0])*5*time)%100;
ent_animate(me,"walk",walk_percent,ANM_CYCLE);
}
}
//Main Function

function main()
{
mouse_mapping();
level_load (FPSP1_str); // Load level
wait(1);
}



Re: Animations locked up [Re: BrockA] #180555
01/29/08 16:57
01/29/08 16:57
Joined: Jan 2007
Posts: 221
F
Fenriswolf Offline
Member
Fenriswolf  Offline
Member
F

Joined: Jan 2007
Posts: 221
Hello,

you have to put this

Code:
// Animations set
if(move_vec[0] == 0 && move_vec[1] == 0)
{
stand_percent = (stand_percent +5*TIME)%100;
ent_animate(me,"stand",stand_percent,ANM_CYCLE);

}
else
{
walk_percent = (walk_percent + sign(move_vec[0])*5*time)%100;
ent_animate(me,"walk",walk_percent,ANM_CYCLE);
}


back into your while loop (right after 'ent_move(move_vec,NULLVECTOR);' ).
Then it should work again.

Re: Animations locked up [Re: Fenriswolf] #180556
01/30/08 03:31
01/30/08 03:31
Joined: May 2006
Posts: 27
B
BrockA Offline OP
Newbie
BrockA  Offline OP
Newbie
B

Joined: May 2006
Posts: 27
Thanks alot dude I don't know why I didn't see that noob mistake =) haha but im learning soo i guess thats alright


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