How do I assign .Y

0 favourites
  • 4 posts
  • Hi All,

    Issue:

    I am new to Construct 2, my first post ever. That being said, some newbie help is needed.... When I try to use this expression below on an object the Y property always stay the same. No mater where the player is on the screen, note it is a platform game.

    Expression:

    (1 + (player.Y))

    More info:

    Player is a sprite box, and im assigning a variable on collision with a target.. The variable is then used to score. The higher the player, the higher the score.

    Thanks, and any help would be great,

    BGTHREE................

  • Are you using an event to set the object Y property? What condition and action are you using?

  • Can't see why that wouldn't work but you do know that Y increases as it goes down the screen right?

    Assuming your window size is 800x600, you want:

    score = 600 - player.Y

    eg.

    1)

    Y = 50 (near the top of the window)

    600 - 50 = 550

    2)

    Y = 490 (near bottom)

    600 - 490 = 110

    If those score results are too high, you can always divide by some number like 20 to get smaller scoring.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • got it to work now i had destroy the object then recreated and spawn then checked the y. duh...

    I moved the player.Y action up above the action block and wall la.

    also i was going to use the height of screen not a hard code value - Y for example and dived by 600 and round off etc. thanks for the advice I already thought this threw I was just not thinking and being a newbie question if I where missing something and had to make a call to set the Y. but it was just had the expression in the wrong order of events.

    thanks guys sorry to bother but you gave me confidence it wasn't the code it was just my order......

    thanks

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