Author Topic: targeter/aiming  (Read 6298 times)

bat

  • Fanatic
  • ***
  • Posts: 234
  • Cheak out the B*t project
    • MSN Messenger - ethanbatmay@hotmail.com
    • Yahoo Instant Messenger - ethanbatmay
    • View Profile
    • The B*t project
    • Email
targeter/aiming
« on: 2006-07-28, 01:03:58 PM »
how would i make a targeter thing to aim with right in front of a character (mario type side scroller)?
like in this game (worms2):
~bat

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: targeter/aiming
« Reply #1 on: 2006-07-28, 01:07:46 PM »
controled by the mouse or the keyboard?
Edward Dassmesser

bat

  • Fanatic
  • ***
  • Posts: 234
  • Cheak out the B*t project
    • MSN Messenger - ethanbatmay@hotmail.com
    • Yahoo Instant Messenger - ethanbatmay
    • View Profile
    • The B*t project
    • Email
Re: targeter/aiming
« Reply #2 on: 2006-07-28, 01:20:12 PM »
either or...
but keyboard would be best
~bat

bat

  • Fanatic
  • ***
  • Posts: 234
  • Cheak out the B*t project
    • MSN Messenger - ethanbatmay@hotmail.com
    • Yahoo Instant Messenger - ethanbatmay
    • View Profile
    • The B*t project
    • Email
Re: targeter/aiming
« Reply #3 on: 2006-07-29, 05:37:14 PM »
would having an object (targeter) follow the player work?
~bat

bat

  • Fanatic
  • ***
  • Posts: 234
  • Cheak out the B*t project
    • MSN Messenger - ethanbatmay@hotmail.com
    • Yahoo Instant Messenger - ethanbatmay
    • View Profile
    • The B*t project
    • Email
Re: targeter/aiming
« Reply #4 on: 2006-07-29, 05:49:21 PM »
even just a "snap to" left,right and above would be ok
~bat

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2752
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: targeter/aiming
« Reply #5 on: 2006-07-30, 06:30:22 AM »
Is scripting an option here?  Because you could make a script that detects when you are pressing left or right, and if you are, it can continuously decrease the angle or increase the angle.  Then to position the "targeter sprite" you get the location of the player sprite and add some offset like this:

TargetSprite.X = PlayerSprite.X + Cos(AngleRadians) * 100
TargetSprite.Y = PlayerSprite.Y - Sin(AngleRadians) * 100

As the player presses left or right, you would increment or decrement AngleRadians by small amounts like:
AngleRadians = AngleRadians + 3.14159265 / 18

bat

  • Fanatic
  • ***
  • Posts: 234
  • Cheak out the B*t project
    • MSN Messenger - ethanbatmay@hotmail.com
    • Yahoo Instant Messenger - ethanbatmay
    • View Profile
    • The B*t project
    • Email
Re: targeter/aiming
« Reply #6 on: 2006-07-30, 11:17:45 PM »
 cool! that's wut i was looking 4! thanks.  ;)
~bat