positioning objects relative to window

Get help using Construct 2

Post » Sat Feb 11, 2012 11:44 am

I don't get it. I thought I got it, but I don't :)

How do I position objects on its creation in the top left corner of the viewport when using fullscreen: scale option. I thought that (assuming it's 640x480) x=320-windowWidth/2, y=240-windowHeight/2 shoud work. But it didn't.

Thanks in advance.
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Feb 11, 2012 11:59 am

Make a "HUD" layer with parallax 0,0, then stick it on that layer at 0,0.
Otherwise, use the scrollx and scrolly expressions.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Feb 11, 2012 12:07 pm

and if I must position this objects on a layer that has parallax = 100 and scale = 100? scrollx and scrolly will give me 320 and 240 (half of the window size which I already know) so that doesn't help.
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Feb 11, 2012 1:46 pm

To top-left corner use:
set X to scrollX - windowWidth/2
set Y to scrollY - windowHeight/2
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Sat Feb 11, 2012 2:13 pm

again, no :(

here's capx:
http://www.mediafire.com/?3bc1p9x0bga4ds0

after 4 seconds the plack box should appear in the top left corner right? well it doesn't :) halp plox :) cheers!
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Feb 11, 2012 3:15 pm

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Sat Feb 11, 2012 8:20 pm

but this object will have movement behaviors and all. I want to position it in the top left only once, without using any behaviors. so again, my question, to be as specific as I can:

how to position my object on creation in the top left corner of the viewport using "set position" action, on a layer that has parallax and scale set to 100.

sorry to be pain in the arse, but please understand, nobody understands me, boo hoo :( :)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Feb 11, 2012 8:47 pm

The anchor is a behavior designed to place objects on a screen position (when the layout/layers are scaled) and keep them there.

What do you mean "movement behavior" ?

You're not expressing your idea or what you're trying to achieve clearly.

The anchor behavior answers the question "how to position my object on creation in the top left corner of the viewport using "set position" action, on a layer that has parallax and scale set to 100."Kyatric2012-02-11 20:48:12
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Sat Feb 11, 2012 8:51 pm

forgot to add "NOT using ANY behaviors". that's what I'm trying to achieve, I'm trying to:

position my object on creation in the top left corner of the viewport using "set position" action, on a layer that has parallax and scale set to 100 NOT using ANY behaviors.

also, of course, bug thanks for trying to help me out with this :)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Feb 11, 2012 8:57 pm

Why "without any behavior" when the simplest and most efficient way is to use the dedicated behavior ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Next

Return to How do I....?

Who is online

Users browsing this forum: emoticon, makkancs and 23 guests