Mirror Sprite Based on dx?

0 favourites
  • 8 posts
From the Asset Store
Advanced inventory mechanics for your RPG game (Array-based). Take Items, split them, pick up them, read the description
  • Hi!

    I am brand new to Construct2, and am having a hard time wrapping my head around how to correctly access instance variables (perhaps this is the wrong word).

    I have an done everything as suggested in the 2d platformer tutorial, and it works, after a fashion, but it doesn't suit my needs.

    When changing direction, I want to set the Mirrored flag based on velocity. I hear this is dx. That makes sense. I cannot find how to check this variable. In a perfect world there would be a transition from running right->changing direction/slowing down->running left and vice versa based on dx (and other things like IsOnFloor or what have you).

    So how do I do this? I've figured out how to check to see if something ELSE is >= to dx, but not if dx is <= 0. Please tell me I don't have to make a 0 CONST and check my CONST to see if IT is greater than dx.

    I need it spelled out.

    --Frustrated, and graciously awaiting your help.

  • Perhaps if the player is moving left but holding right, you would have a skidding animation?

    Is this what you mean?

    I'm not sure about velocity but if your character has a lot if momentum, you could just check if you are holding left when moving right and vice-versa.

  • yes, but my very newbie question is how do I check to see in which direction the character is moving?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • dx is called VectorX in the platform object. The expression you need is:

    Sprite.Platform.VectorX

    'Sprite' refers to the name of object with the platform behaviour. Then 'Platform' refers to the behaviour and 'VectorX' to the change in X direction. Also, you can always take a look at the platform behaviour in the manual.

  • Thanks for the reply!

    Believe me, I have scoured the manual in regards to expressions, platform, and the like. What I need is the understand of HOW to access that. How do I do what you just said?

    What I am trying to do is click a button to add an event/condition that checks the Player.VectorX to see if it is below, at or above zero.

    It seems to give me no option to do this.

    I say this because if I create a condition to check some random thing I can THEN see the expressions pane and choose to see if something ELSE (That random thing I selected) is set to Player.VectorX, but I cannot access this pane when selecting the first part of a conditional check.

    (Platform has things like CompareSpeed exposed! SPEED, but I need a velocity for my purposes. I even hear that VectorX and VectorY are Accompanied by Angle and Speed for Polar use, but I cannot find Angle either...)

    This is why I am worrying about having to make a global const for ZERO and then checking to see if IT is greater than, equal to or less than Player.VectorX.

    To me that seems like such a horrible and backwards way to access this information, and I don't want to stray too far from best practices before my character can even turn around fluidly, but it is as of yet the only way I can figure out how.

    I thank you in advance!

  • Pretty easy if I am understanding correctly, create a new event:

    System > Compare Two Values

    For the First Value type ObjectName.Platform.VectorX

    For the Second Value Type 0

    And choose the comparison in the middle dropdown (Greater Than, etc...)

    To make this easier, notice that when you are clicking in the text box for the first value, that there is a semi transparent window above the current one, mouse over it and you will get access to all the objects and their expressions...

  • DING! Thank you so much!

    I come from a more object-oriented background where things are very encapsulated, so it never occurred to me to check in System to compare a value for the player object...

    Shifting my thinking is proving difficult, so I will definitely be back with more poorly-worded, yet ultimately easy-to-answer, questions.

  • cincipon YEah same here, my background is in .Net development, though way back in the day I did a lot of flash dev too...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)