Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, degenerate_762, ozgur), 1,311 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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