Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Quad, VoroneTZ, 1 invisible), 862 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Particle rotating around the player #223524
08/24/08 21:48
08/24/08 21:48
Joined: Aug 2008
Posts: 49
V
Vyse220 Offline OP
Newbie
Vyse220  Offline OP
Newbie
V

Joined: Aug 2008
Posts: 49
I'm trying to create a videogame, i'm asking for a code of a particle fuction that must be like a comet rotating around the player.
I'm still a newbie, if someone can show me the code or give me a tutorial i will be glad.
Thx and sorry for my bad english

Re: Particle rotating around the player [Re: Vyse220] #223599
08/25/08 11:17
08/25/08 11:17
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline
Member
Impaler  Offline
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
For a comet rotating around the player, I'd try something like this:


//this function controls the rotation of the comet
function comet_turn()
{
var radius = 100;
var angle = 0;
var speed = 5;
while(my)
{
angle += speed * time_step;//rotate the angle
vec_set(my.x, your.x);
my.x += radius * cos(angle);//figure out x and y position
my.y += radius * sin(angle);
effect(comet_trail, 1, my.x, nullvector);//particle effect
wait(1);
}
}

// create a comet object from the player action: just insert this at the start of your player's action

ent_create("asteroid.mdl", my.x, comet_turn);


hope this works! you'll have to substitute your own files for the comet model and your own particle effect for the rotating comet to leave a trail.


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).

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