glue something to the top of the screen?

0 favourites
  • 4 posts
From the Asset Store
Save hours of work by resizing items on your game screens.
  • The anchor behavior cannot center sprites. Using events, I can center a sprite Horizontally Ok, but I cant do anything with it vertically, it just jumps around and goes a random Y, sometimes going off screen completely.

    https://www.dropbox.com/s/opoehw830axlyc3/viewportYproblem.capx

    The code I am using is this:

    Browser On resized : mylogo Set Y to ViewportTop("lobby") + 27

                         mylogo Set X to (ViewportLeft("lobby") + ViewportRight("lobby")) / 2

    I want to fix the logo 27 pixels from the top of the screen. It just doesnt work.

    Any ideas why? I'm sure I used to do it like this.

    Note: I have set the origin of the logo sprite to be X in the center, Y at the top. (i.e. origin x=width/2, y=0)

  • I just tried your example in chrome. And it seems to work fine when you just resize the window. But if you maximize or minimize the window it looks like the browser-->resize is not called.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • cvp, did you resize vertically? If you resize horizontally (make it wider or narrower, its ok, but making the window longer/shorter leaves the sprite at completely random locations, some times off the screen at the top, sometimes half way down the screen. It only works if you make it longer/shorter really slowly and carefully. The same code for X (i.e. for horizontal movement) is fine, its just vertically that its hugely buggy.

    In FF, I sometimes get a blank black screen also.

    I just tried it in FF, and its just as buggy. Try making the browser longer quickly in jumps.

    This bug used to be in Anchor, many versions ago (99?) which is why I dont use it any more. Until now, setting the Y manually has worked instead.

    If i change the project to set Y every tick, its fine, but doing operations every tick like this will affect performance.

    I suspect that its the Browser On resized which is the problem - its missing re-size events for what ever reason.

  • I tried this out and the logo stays where it starts always. (vertically)

    I'm using FF version 22.0

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