Nevermind, I found out! Woooooo!
- Code: Select all
int xx;
int yy;
int i;
int xvol = xvelocity;
int yvol = yvelocity;
while(i < 1000){
xx += xvol;
yy += yvol;
if(xx >= width*0.5 || xx <= width*0.5*-1){
xx += -10*(xvol*xvol)/abs(xvol)/xvol;
i = 1000;
}
if(yy >= height*0.5 || yy <= height*0.5*-1){
yy += -10*(yvol*yvol)/abs(yvol)/yvol;
i = 1000;
}
i++;
}
To get the exact position just add tha actor's real cordinates.
- Code: Select all
xx += x;
yy += y;
The "xx += -10*(xvol*xvol)/abs(xvol)/xvol;" and "yy += -10*(yvol*yvol)/abs(yvol)/yvol;" aren't needed, that's just something I used to find the coordinates to create my particles. I set the position back 10 pixels from the hit cause the thing it was hitting was messing with their look lol. Just included them to show how you may want to fine tune it using some nice math. I have the loop end at 1000 because I found that sometimes ge bugs and the loop never ends, not very often, so I made a failsafe. Plus I doubt you'll ever need a collision point that'll be beyond that. But if you do, just change the limits. Don't know how fast this is, but it works fine for me
Enjoy ^-^