Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › How to Find Direction of a Sprite?
New Posts  All Forums:Forum Nav:

How to Find Direction of a Sprite?

post #1 of 2
Thread Starter 
I am trying to create a program to simulate gravity on objects, and to do so I need a way of finding the direction of particular sprites. I'm not quite sure on what I would need to do to calculate the direction of a sprite from the centre of the window...

I am creating it in Liberty BASIC.
Thanks in advance
Edited by JacP3 - 8/18/13 at 12:47am
post #2 of 2
If the Scarecrow can figure this one out, then so can you! wink.gif

I'm assuming that you are tracking the position of the sprite, in the form of x,y coordinates.




Imagine corner A is the center of the window, and corner B is the position of the sprite. So then side b = x, and side a = y. And the rest writes itself...
Death Star
(21 items)
 
Darksaber
(11 items)
 
 
CPUMotherboardGraphicsRAM
Athlon II x2 245 Asus M3A78 Radeon HD6570 1GB Mushkin Silverline 2GB DDR2  
Hard DriveOptical DriveOSMonitor
OCZ Vertex 2 120GB Samsung Blu-Ray Windows 7 Samsung 46" DLP 
PowerCaseOther
Silverstone Strider Essentials 400W Silverstone Milo ML03B Hauppage WinTV 1250 
  hide details  
Reply
Death Star
(21 items)
 
Darksaber
(11 items)
 
 
CPUMotherboardGraphicsRAM
Athlon II x2 245 Asus M3A78 Radeon HD6570 1GB Mushkin Silverline 2GB DDR2  
Hard DriveOptical DriveOSMonitor
OCZ Vertex 2 120GB Samsung Blu-Ray Windows 7 Samsung 46" DLP 
PowerCaseOther
Silverstone Strider Essentials 400W Silverstone Milo ML03B Hauppage WinTV 1250 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › How to Find Direction of a Sprite?