![]() |
Reflecting projectiles...
I'm working with some projectiles and bouncing them off walls... I'm just having a little problem with it.
Basically, it's easiest to approach it ala Pong. If it hits the wall on it's x axis to flip it's x velocity, and the same for its y velocity. The only problem is that's kind of hard to detect with projectiles. At first I had it when it hit a wall to determine it's 'direction' using getdir and it's velocity, but when dealing with 45° shots, it tends to screw up because it's determining the wrong direction. Any help here? |
What I would do is just shoot the same projectile from the point of impact, so that it looks the same.
Also, I would suggest storing the angle on the player using a simple script: PHP Code:
|
I have all that being done. What's not being able to be done right is determining whether to inverse the x or y velocity because I can't figure out how to detect whether the projectile is hitting the wall on it's x or y axis.
|
Quote:
|
It's a projectile
|
Quote:
Make your own projectile via class? :D |
onActionProjectile2(). You could find the right angles, then shoot() again in the right angle.
|
I already have the projectile worked out. It shoots back and all. I'm just having the problem of determining which side of the projectile actually hits the wall so I can reflect it properly.
And I dunno about the class thing, seems like a lot of effort and a lot less effecient to use a class. |
Quote:
|
Yes, except that's way out of the way for something that's pretty simple and works in just about every way except for this one thing.
|
| All times are GMT +2. The time now is 06:45 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.