0 registered members (),
1,397
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Can you help me with this function?
#255175
03/08/09 12:12
03/08/09 12:12
|
Joined: Aug 2008
Posts: 49
Vyse220
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 49
|
The idea is that when an enemy is killed, a flow of particles moves from the destroyed enemy to the player. function move_power(){
my.passable = on;
my.size = 0.1;
var c;
while(vec_dist(me, player) > 10 && my. x > -200){
ent_move(vector(-10, 0, 0), vector(-5, 0, 0));
c = random(360);
effect (minpart, 10, my.x, nullvector);
wait(1);
if(my.z < player.z){
my.z += 5;
}
if(my.y > player.y){
my.pan += 4;
my.y -= 5;
}
else{
my.pan -= 4;
my.y += 5;
}
}
ent_create("glow.tga", vector(player.x, player.y, player.z - 80), explosion_ring1);
ent_remove(me);
} I've done it with this code, but it isn't good, the movement is not good. Can you help me to do something better? I've used particles, but i would like to use the "beam effect". This is a demostration of my work as you can see, the movemen't isn't "smooth".
Last edited by Vyse220; 03/08/09 12:13.
|
|
|
Re: Can you help me with this function?
[Re: Vyse220]
#255266
03/09/09 08:50
03/09/09 08:50
|
Joined: Jan 2009
Posts: 86 Brasil - RS
DiegoFloor
Junior Member
|
Junior Member
Joined: Jan 2009
Posts: 86
Brasil - RS
|
Hello! First of all, I still don't know anything about particles, so if I say something that doesn't make any sense jsut ognore But aesthetically maybe I can help. My first impression was that the particles were in a perfect line and all of the same size. A few patterns I can think of: -Make the first one bigger and the following gradually smaller (with random oscilations); -Also, change the opacity so that the last ones on the line are barely visible (making the opacity oscilate a little could work too) Also, you can try to make additional layers of particles to achieve some sort of glow effect. Or even sparkles leaving the main trail in random directions. I'm about to start playing around with particles too.. isn't there some sort of particle editor? it's hard to come up with something visually appealing only with coding.
|
|
|
Re: Can you help me with this function?
[Re: DiegoFloor]
#255301
03/09/09 12:56
03/09/09 12:56
|
Joined: Aug 2008
Posts: 49
Vyse220
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 49
|
Hello! First of all, I still don't know anything about particles, so if I say something that doesn't make any sense jsut ognore But aesthetically maybe I can help. My first impression was that the particles were in a perfect line and all of the same size. A few patterns I can think of: -Make the first one bigger and the following gradually smaller (with random oscilations); -Also, change the opacity so that the last ones on the line are barely visible (making the opacity oscilate a little could work too) Also, you can try to make additional layers of particles to achieve some sort of glow effect. Or even sparkles leaving the main trail in random directions. I'm about to start playing around with particles too.. isn't there some sort of particle editor? it's hard to come up with something visually appealing only with coding. I remember a tool that was in the site, something that show in real time the particles and instead put the velocity, the size and other proprieties. It can be really usefull. However my problem is't the particle, but the movement of them, thx for the help.
|
|
|
Re: Can you help me with this function?
[Re: Vyse220]
#255314
03/09/09 14:20
03/09/09 14:20
|
Joined: Nov 2008
Posts: 215
vertex
Member
|
Member
Joined: Nov 2008
Posts: 215
|
I know this might not help for a variable/dynamic particle method-- but nonetheless: a great tool for particles for Gamestudio: http://www.easyparticle.com/developed by: Timo Stark, Martin Teichmann
Last edited by vertex; 03/09/09 14:32.
|
|
|
Re: Can you help me with this function?
[Re: Vyse220]
#255677
03/11/09 20:29
03/11/09 20:29
|
Joined: Jan 2009
Posts: 86 Brasil - RS
DiegoFloor
Junior Member
|
Junior Member
Joined: Jan 2009
Posts: 86
Brasil - RS
|
Ooh! You want a better trajectory? is that it? You can achieve "some sort" of parabolic movement simply by making the velocity vector of the particle always pointing at the player. To give it a little more movement, make the velocity vector's amplitude increase gradually, this way the particle will "fall" a little (to the bottom of the screen) before gaining velocity towards the player. (This is known as the predator-prey model) Another possibility is to make the player something like a sun and the particle a tiny planet. Of course, you're not using the physics system, so you have to code this interaction yourself. But it's not difficult! Basically, you have to make tiny incremente to the particle's velocity towards the player per time unit (it's slightly different from the first approach). To make this solution more like a sun-planet system, make the increment increase with the distance to the player. I don't know squat about coding particles, but at least I know a little about physics yay edit: ...make the increment decrease with the distance... Because we want the particle to get more accelerated as it gets closer to the player.
Last edited by DiegoFloor; 03/11/09 20:33.
|
|
|
Re: Can you help me with this function?
[Re: DiegoFloor]
#255828
03/12/09 20:55
03/12/09 20:55
|
Joined: Aug 2008
Posts: 49
Vyse220
OP
Newbie
|
OP
Newbie
Joined: Aug 2008
Posts: 49
|
You can achieve "some sort" of parabolic movement simply by making the velocity vector of the particle always pointing at the player. To give it a little more movement, make the velocity vector's amplitude increase gradually, this way the particle will "fall" a little (to the bottom of the screen) before gaining velocity towards the player. (This is known as the predator-prey model) Thx for it, but can you explane me how to set a vector from the destroyed enemy to the player and move one object towards it please?
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|