Gamestudio Links
Zorro Links
Newest Posts
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (kzhao, 1 invisible), 3,723 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joe_kane, Namitha_NN, Syndrela, agasior, mosfet
19189 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Random animation #114781
03/02/07 23:17
03/02/07 23:17
Joined: Jul 2006
Posts: 28
B
burning_devil Offline OP
Newbie
burning_devil  Offline OP
Newbie
B

Joined: Jul 2006
Posts: 28
Does anyone know a way to program a code where i can play certain animations random when i press a key?

Re: Random animation [Re: burning_devil] #114782
03/03/07 00:17
03/03/07 00:17
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Code:

// Has 3 animation cycles
define ASceneMax, 3;

string AScene[ASceneMax];
...
ACTION RandomAnim
{
AScene[0] = "Walk";
AScene[1] = "Run";
AScene[2] = "Stand";
// ...
while(1)
{
if (!my.skill10 & key_space)
{
my.skill11 = int(random(ASceneMax));
//
my.skill10 = min(my.skill10 + (my.skill1 * time), 100);
ent_animate(my, AScene[my.skill11], my.skill10, 0);
wait(1);
}
wait(1);
}
}



This should work, but I'm not sure if you can use arrays with strings. If not, then I've got another example for you...

Last edited by xXxGuitar511; 03/03/07 00:17.

xXxGuitar511
- Programmer

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