positioning objects relative to window

Get help using Construct 2

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: 6,999
Reputation: 57,793

Post » Sat Feb 11, 2012 9:08 pm

because I hope it's easy and nobody will ask why and just answer. this was tldr version :) the real reason is because this sprite will have a custom movement based on moving towards other sprites scattered through playfield and the anchor behavior will collide with the custom movement behavior, they just won't work together. also, I beg you, how do I get an answer to my question without being rude, I really have a dream that someday, I come here, ask question and just get working answer without waiting whole day, explaining that answers provided by some don't work, to others why am I tryind to achieve this and why this and not other way. really didn't mean to be rude in any way and of course I'm super grateful for any input at all, but still hoping to get a good answer at some point. cheers!ranma2012-02-11 21:11:15
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sat Feb 11, 2012 10:49 pm

Animmaniac's solution should have worked. It appears to be a bug that it doesn't work with "fullscreen on(scaled)" as it works with "fullscreen off" and "fullscreen on (crop mode)". To be exact the scrollx and scrolly expressions are returning a position that's in the center of the screen but doesn't seem to have a correlation to the screen size.

Now for a workaround select "fullscreen on (crop mode)" and set the scale manually. Then use these actions:

Set layout scale to: min(WindowWidth/640,windowheight/480)
Sprite set x: scrollX - WindowWidth/(LayoutScale*2)
Sprite set y: scrollY - WindowHeight/(LayoutScale*2)R0J0hound2012-02-11 22:49:43
B
79
S
24
G
54
Posts: 4,738
Reputation: 40,739

Post » Sat Feb 11, 2012 11:00 pm

ok, thanks a bunch for that, also posting this as a bug in bugs. thanks again, cheers!
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sun Feb 12, 2012 9:10 pm

Eureka,
I realized it was a different issue. In your capx use the edittime windowwidth and windowheight values for positioning.

For ex. it would be
Sprite set x: scrollX - 640/2
Sprite set y: scrollY - 480/2

So you would do the math as if the window were not scaled at all.

Edit:
Actually it looks like no issue at all. I thought it was because with unbounded scrolling off scrollx and scrolly were returning 479.25 and 240, but it seems to be correct.
B
79
S
24
G
54
Posts: 4,738
Reputation: 40,739

Post » Sun Feb 12, 2012 9:22 pm

ok, and if you do check the unbounded scrolling on, what then? how to position the object the way that I want to from the start?
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Sun Feb 12, 2012 10:42 pm

Put a sprite with anchor as a position marker. Set it to invisible, on start of layout position your moving object to the marker's position.
Kind of work around, but it should do the job of positioning a moving object on some spot of the screen despite the scale.

[QUOTE=ranma]also, I beg you, how do I get an answer to my question [...] and just get working answer [/QUOTE]

Ask a complete detailed question.
Explaining you had already tried the anchor and that it didn't fit the full scope of what you wanted to do (a custom moving object) was a far better explanation than just "no behavior".
People can't guess what you already have done on a written post. The more details you give, the more likely to get an efficient answer you are.
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: 6,999
Reputation: 57,793

Post » Sun Feb 12, 2012 10:45 pm

wow, that solution was unexpected, but works great! big thanks!

and will try to do that next time I will ask something. thanks again :)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Previous

Return to How do I....?

Who is online

Users browsing this forum: Artpunk, Axiomaltd, MACPK, nicklowkcmagic, OddConfection, Yahoo [Bot] and 23 guests