Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-07-2007, 01:30 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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?

Last edited by DustyPorViva; 04-07-2007 at 02:11 PM..
Reply With Quote
  #2  
Old 04-07-2007, 02:12 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
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:
temp.angle int(arctan((playerx dx) / (playery dy)) * pi 180); 
Of course, That would store the angle of where the projectile is going and then you can use that to figure out what angle to shoot the new projectile.
__________________
What signature? I see no signature?
Reply With Quote
  #3  
Old 04-07-2007, 02:18 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #4  
Old 04-07-2007, 03:40 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by DustyPorViva View Post
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.
Why not? the simplest solution in this situation would to be to set up two onwall checks in the shape of a cross through the ball. Then you would know which axis hit.
__________________
Reply With Quote
  #5  
Old 04-07-2007, 03:45 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
It's a projectile
Reply With Quote
  #6  
Old 04-07-2007, 04:05 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by DustyPorViva View Post
It's a projectile
Sorry I just woke up and took it out of context.
Make your own projectile via class?
__________________
Reply With Quote
  #7  
Old 04-07-2007, 04:34 PM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
onActionProjectile2(). You could find the right angles, then shoot() again in the right angle.
__________________
Reply With Quote
  #8  
Old 04-07-2007, 05:44 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
  #9  
Old 04-07-2007, 07:43 PM
Kristi Kristi is offline
Bowie's Deciple
Kristi's Avatar
Join Date: Dec 2003
Location: Boston, MA
Posts: 748
Kristi has a spectacular aura aboutKristi has a spectacular aura about
Send a message via AIM to Kristi Send a message via MSN to Kristi
Quote:
Originally Posted by DustyPorViva View Post
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.
a projectile is an object spawned with a clientside and serverside, it really is no different.
__________________
Reply With Quote
  #10  
Old 04-07-2007, 09:35 PM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:33 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.