Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

891097 Posts in 33521 Topics- by 24766 Members - Latest Member: karlari84

June 18, 2013, 09:07:34 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)(Stencyl) An Rpg game Problem
Pages: [1]
Print
Author Topic: (Stencyl) An Rpg game Problem  (Read 211 times)
dincicode
Level 0
**


My site - http://www.cube3graphics.com/


View Profile WWW Email
« on: March 11, 2013, 11:46:48 AM »

I'm trying to make a character that turns to the direction of the target but the game is not a top view.

So basically i need it to be like this for example if the target is in -22,5° to 22,5° i need the character to face 1(east) and than if the target is facing 22,5° to 45° the character would face 2(south-east) etc etc.

Can anyone help me with this, I did get a messy version of this working but it only does west, south-west, south, south-east and east directions nothing above the equator so to speak works.
Logged

Graphics artist with more then 5 years of experience in Illustrating Comics, Designing Characters, Making Game Cut Scenes, Posters, and Covers among other things.
GroZZleR
Level 0
**



View Profile WWW
« Reply #1 on: March 11, 2013, 04:59:03 PM »

I'm not familiar with Stencyl, but it sounds like its rotation system range is 0 to 180 then -180 back down to -0?

If so, convert it 0-360 with something like this:  degrees = ((rotation % 360) + 360) % 360;

Then add 22.5 degrees and divide by 45 to get your direction: direction = (degrees + 22.5) / 45;

Finally direction = 0 should be east, direction = 1 should be south east and so on.
Logged

dincicode
Level 0
**


My site - http://www.cube3graphics.com/


View Profile WWW Email
« Reply #2 on: March 11, 2013, 05:13:24 PM »

Yeah I forgot to mention I already solved it the problem was indeed the fact that i was using 0 to 360 instead of 0 to 180 and 0 to -180.
Logged

Graphics artist with more then 5 years of experience in Illustrating Comics, Designing Characters, Making Game Cut Scenes, Posters, and Covers among other things.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic