How do I assign .Y

Get help using Construct 2

Post » Mon Dec 03, 2012 7:33 am

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................
biggthree2012-12-03 07:35:47
B
3
Posts: 2
Reputation: 379

Post » Mon Dec 03, 2012 7:42 am

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

B
20
S
4
G
2
Posts: 124
Reputation: 2,482

Post » Mon Dec 03, 2012 2:14 pm

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.procrastinator2012-12-03 14:14:48
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Wed Dec 05, 2012 4:34 am

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
B
3
Posts: 2
Reputation: 379


Return to How do I....?

Who is online

Users browsing this forum: emoticon, MrWhizm and 17 guests