Gamestudio Links
Zorro Links
Newest Posts
FXCM demo test failed
by qin. 01/13/26 02:32
Camera always moves upwards?
by NeoDumont. 01/12/26 09:39
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
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (qin), 3,155 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
promfast, joe_kane, Namitha_NN, Syndrela, agasior
19190 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 | 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