Scrolling Game Development Kit Forum
Welcome, Guest. Please login or register.
2010-09-09, 05:35:42 PM

Login with username, password and session length
Search:     Advanced search
8920 Posts in 1007 Topics by 168 Members
Latest Member: mogzdogz
* Home Help Search Login Register
+  Scrolling Game Development Kit Forum
|-+  SGDK Version 1
| |-+  General Discussion
| | |-+  targeter/aiming
« previous next »
Pages: [1] Print
Author Topic: targeter/aiming  (Read 2021 times)
bat
Fanatic
***
Posts: 229


Cheak out the B*t project

ethanbatmay@hotmail.com ethanbatmay
View Profile WWW Email
« on: 2006-07-28, 02: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):
Logged

~bat
durnurd
Lead Lemming
Expert
Fanatic
*****
Posts: 1155


Games completed so far: 0

durnurd@hotmail.com
View Profile WWW
« Reply #1 on: 2006-07-28, 02:07:46 PM »

controled by the mouse or the keyboard?
Logged

Edward Dassmesser
bat
Fanatic
***
Posts: 229


Cheak out the B*t project

ethanbatmay@hotmail.com ethanbatmay
View Profile WWW Email
« Reply #2 on: 2006-07-28, 02:20:12 PM »

either or...
but keyboard would be best
Logged

~bat
bat
Fanatic
***
Posts: 229


Cheak out the B*t project

ethanbatmay@hotmail.com ethanbatmay
View Profile WWW Email
« Reply #3 on: 2006-07-29, 06:37:14 PM »

would having an object (targeter) follow the player work?
Logged

~bat
bat
Fanatic
***
Posts: 229


Cheak out the B*t project

ethanbatmay@hotmail.com ethanbatmay
View Profile WWW Email
« Reply #4 on: 2006-07-29, 06:49:21 PM »

even just a "snap to" left,right and above would be ok
Logged

~bat
bluemonkmn
SGDK Author
Administrator
Fanatic
*****
Posts: 2146


2678251 BlueMonkMN@gmail.com
View Profile WWW Email
« Reply #5 on: 2006-07-30, 07: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
Logged

bat
Fanatic
***
Posts: 229


Cheak out the B*t project

ethanbatmay@hotmail.com ethanbatmay
View Profile WWW Email
« Reply #6 on: 2006-07-31, 12:17:45 AM »

 cool! that's wut i was looking 4! thanks.  Wink
Logged

~bat
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!