Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
I need some help with my code #383807
09/25/11 17:53
09/25/11 17:53
Joined: Sep 2011
Posts: 1
Sonstige
Y
Yondayime Offline OP
Guest
Yondayime  Offline OP
Guest
Y

Joined: Sep 2011
Posts: 1
Sonstige
Hello!

I just started to learn programming and now I've got a problem...
I created a "side-rolling"-game with nothing really in it. Just a ball and a stage to roll on.

Then I thought, it would be cool, if I clicked the shift key, an animation on the ball would appear. So I created an animated sprite to do that. Then I played with the code and suddenly I got something..well..funny. I created the sprite over and over again, reaaaaally fast, so my ball, who could just roll and jump, could fly how I controlled it, creating a "worm" of my sprite-animation. Well, then I got the "1000-entities-max" problem. I knew, rising the limit wouldn't help, so I thought of removing the last parts of the "worm" after ~2 seconds.
But if I have the following:

if(key_shift)
{
leuchte = ent_create("leuchte+5.tga", vector(my.x=ball.x,my.y=ball.y,my.z=ball.z) , leuchten);
wait(-0.5);
ent_remove(leuchte);
}

*leuchte is my entity, leuchte+5 is my sprite

The ball stays where it is, creating the sprite-animation and after 0.5 seconds I can roll again. When I choose 1 instead of -0.5, the first frame of my sprite appears, disappears and reappears in fast pace.

The "worm" only comes, if I remove the "ent_remove" thing.
Can someone help me? I want the last parts of the worm to disappear after a short time.

Re: I need some help with my code [Re: Yondayime] #383808
09/25/11 18:08
09/25/11 18:08
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Kartoffel Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
I don't exactly understand what your problem is, but this might help:

Code:
function abc()
{
   you = ent_create("leuchte+5.tga", vector(ball.x,ball.y,ball.z) , leuchten);
   wait(-0.5);
   ent_remove(you);
}

[...]

if(key_shift)
{
   abc();
}



another thing:
vector(my.x=ball.x,my.y=ball.y,my.z=ball.z);

I dont know if this works but it should be like this:

vector(ball.x,ball.y,ball.z)

and instead of this you can just write:

ball.x

Last edited by Kartoffel; 09/25/11 18:12.

POTATO-MAN saves the day! - Random

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