Results 1 to 3 of 3

Thread: How do I make an entity face a certain direction?

  1. #1

    Default How do I make an entity face a certain direction?

    trying to figure this out so my charachter isn't always facing up, ive tried a few things but nothing works.

    what i want to do is have it so that if you push a directional key, the guy faces that direction.

  2. #2
    Administrator Seth's Avatar
    Join Date
    Jul 2002
    Location
    Japan
    Posts
    5,340

    Default

    Well, it kinds of depends on your setup, if you are using a BrainManager with a "StandardBase", it's very easy.

    Just set the direction like this:

    Code:
    this:SetFacing(C_FACING_LEFT);
    (Or use SetFacingTarget() if you want the character to actually rotate/turn towards the direction instead of instantly change)

    And if you have a visual profile setup, it will automatically use the correct animation for the active direction.

    Or, if you're doing things in vector math and don't want to mess with the direction constants, you can do it like this:

    Code:
    this:SetFacing(VectorToFacing(Vector2(0,1)))
    (0,1 means "down" in a unit vector, 0 on the x axis, and 1 on the Y axis)

    If you are not using a StandardBase brain (or no brain, that's ok too), but still want the ease of use of visual profiles, manually set things every time there is a change like this:

    Code:
    this:SetVisualState(C_VISUAL_STATE_IDLE);
    this:SetFacing(C_FACING_LEFT);
    this:SetSpriteByVisualStateAndFacing();
    Seth A. Robinson
    Robinson Technologies

  3. #3

    Default

    but if i want it to turn a bit left from the angle it already has, how do i do that?
    and if i want it to fly a bit forward from the way its pointing, how do i do that?

Similar Threads

  1. Problem with turorial 'convert to entity'
    By hellbound007 in forum Novashell Game Creation System
    Replies: 2
    Last Post: 05-30-2008, 12:58 PM
  2. How do I make a new map
    By Gill in forum Novashell Game Creation System
    Replies: 2
    Last Post: 03-13-2008, 04:11 PM
  3. D-MOD It's to hard to make!
    By Dinkarl in forum Dink Smallwood HD
    Replies: 5
    Last Post: 03-19-2007, 05:08 AM
  4. Feature Request - Shadow Direction and Color
    By loken in forum Novashell Game Creation System
    Replies: 3
    Last Post: 01-12-2007, 08:10 PM
  5. How to make a d-mods?
    By in forum Dink Smallwood HD
    Replies: 0
    Last Post: 04-19-2003, 12:13 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •