How do I spawn it ou of the screen regardless of resolution?

  • I would like to know how to spawn an enemy out of the player view (out of the game screen) regardless of resolution/window size.

    Since i'm developing my game for mobile devices, I would to like to make the enemies spawn correctly in any device.

    Any tips?

  • Anyone can help me?

  • I don't know if it works, can't try it right now, but try System>Create Object on WindowLeft(or top, bottom, right).X-100, WindowLeft.Y

  • I don't know if it works, can't try it right now, but try System>Create Object on WindowLeft(or top, bottom, right).X-100, WindowLeft.Y

    Thanks for the idea, but this WindowLeft command doesn't exist...

  • > I don't know if it works, can't try it right now, but try System>Create Object on WindowLeft(or top, bottom, right).X-100, WindowLeft.Y

    >

    Thanks for the idea, but this WindowLeft command doesn't exist...

    I don't remember the command, i don't have c2 right now, maybe it calls ViewportLeft, Right, Top, Bottom.

  • Here the capx example, it work's the way you describing it.

  • You can also use LayoutWidth / LayoutHeight, as you know how big your layout is

  • You can also use LayoutWidth / LayoutHeight, as you know how big your layout is

    Man, i'm developing a Platformer RPG, so the layout width is alot bigger than the window size...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • >

    > > I don't know if it works, can't try it right now, but try System>Create Object on WindowLeft(or top, bottom, right).X-100, WindowLeft.Y

    > >

    >

    > Thanks for the idea, but this WindowLeft command doesn't exist...

    >

    I don't remember the command, i don't have c2 right now, maybe it calls ViewportLeft, Right, Top, Bottom.

    I've already tried viewpoRight and Left, but the Left one don't seem to work correctly, spawning the enemies at a fixed point only...

  • Do you want to spawn them on specific places over the layout? or just wherever but outside windows size?

  • Do you want to spawn them on specific places over the layout? or just wherever but outside windows size?

    Left and Right outsides of the screen

  • Here the capx example, it work's the way you describing it.

    Mmm, in your example it seems to work correctly.. Strange.. I'll give it another try and check if it works now

  • Hmm, If I understand it correctly you need to spawn them just outside the window, doesn't spawning them at let's say Player.X + windowWidth solve the problem? How exactly do you want them to spawn?

  • Hmm, If I understand it correctly you need to spawn them just outside the window, doesn't spawning them at let's say Player.X + windowWidth solve the problem? How exactly do you want them to spawn?

    Yes, and I used to use this method, but I discovered that if I resize the browser window, changing the windowWidth, it begins to spawn incorrectly, since it begin smaller/bigger, the point is changed, understood?

  • "viewportleft - something" and "viewportright + something" should work as expected..

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