Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Quad), 4,644 guests, and 16 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A little help for a n00b #366158
04/01/11 18:28
04/01/11 18:28
Joined: Apr 2011
Posts: 2
D
Darkflare19 Offline OP
Guest
Darkflare19  Offline OP
Guest
D

Joined: Apr 2011
Posts: 2
hey, couple of simple questions

How do you use 'accelerate' without the system crashing and I mean a simple program I'm literally messing about with script 18 from the online tutorial pack of scripts.

var accel = 5
var accelneg = -5
function main()
{
level_load ("work18.wmb");

}

action move_me()
{
while(!key_cuu) wait(1); // wait for up key
while(1)
{
if (key_cuu) accelerate(NULL, accel, 1) ;
if (key_cud) accelerate(NULL, accelneg, 1);


var distance_fwdorbck = (key_cuu-key_cud) *5*time_step;

c_move(me, vector(distance_fwdorbck,0,0), NULL, GLIDE);
my.pan += (key_cul-key_cur)*2*time_step;
wait(1);
}
}

It runs the program fine, but then says system crash in move_me: SYS in an error window when I run the program and press up.

If you don't know why the above happens could you tell me how to accelerate an object another way

Cheers.

Re: A little help for a n00b [Re: Darkflare19] #366162
04/01/11 18:49
04/01/11 18:49
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
You can't pass NULL as the first parameter to accelerate. It needs a pointer to a var, and it will change the value stored in this var.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: A little help for a n00b [Re: JibbSmart] #366164
04/01/11 18:58
04/01/11 18:58
Joined: Apr 2011
Posts: 2
D
Darkflare19 Offline OP
Guest
Darkflare19  Offline OP
Guest
D

Joined: Apr 2011
Posts: 2
Cheers, I got rid of the NULL and replaced them both with distance_fwdorbck (which is the variable (key_cuu-key_cud)*5

And it doesn't crash anymore, but it doesn't accelerate either, just stays at a constant speed.

Anyway could I make the object accelerate at a certain rate?

Or is there anyway I could increment the variable above by a certain amount every second the corresponding button is being held down?

Thanks again.

Re: A little help for a n00b [Re: Darkflare19] #366169
04/01/11 19:19
04/01/11 19:19
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Perhaps reduce the friction (third parameter)?

Jibb


Formerly known as JulzMighty.
I made KarBOOM!

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