Sticking walls, floors, and ceilings to device boundaries

When positioning a ceiling (for example), what is the best way to make sure they stick to the game's "height". I tried constraining to both the device height and the camera height (plus 1/2 the height of the actor) to get it stuck to the top of the screen. On the iPad preview, both work like a charm. But when I switch to test it on the iPhone preview, the ceiling ends up in the middle of the screen (both on letterbox and crop mode).

I'm developing for iPad landscape w/ resolution independence on.

The goal is to create the game boundaries and position elements programatically so we don't have to tweak the design or gameplay for the various screen sizes. Any ideas?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @JoeNewNine

    Hi, I'm not getting why you've the complication of using Constrain (let alone any other behaviours); or any rules, to get an image - like a ceiling to be in a certain place... why not just place it where it should go with x and y coordinates for each platform? Or am I missing something here...
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    Don't constrain - that is working all the time - Change Attribute - there is a chance that this rule will not fire in time so perhaps put a very short timer on it. Also see the post "Timers are for chumps" to see how to do accurate timers.

    However, the safer way is to do it is like @gyroscope says - you know all the resolutions so you can make a rule that says if screen.Height = ### then Change Attribute self.Position.Y to ###.

    Do the same for X and Y and the 3 resolutions of iOS.

    That is what I would do.

    @FryingBaconStudios has done a video, on YouTube on how to do this with Android - a much more fragmented platform.

    If there are better ways to do this keen to hear them too :) Cheers, M@
  • ericzingelerericzingeler Member Posts: 334
    This can be done, but first... don't use constrain to position stationary actors. Instead, turn off the "moveable" option for the actor and use change attribute behaviors outside of rules. Any behaviors that you need to run at scene start, place at the top inside the actor.

    I've found that device screen size is not worth using. Try scene > camera size instead.
Sign In or Register to comment.