Pinned objects goes out of the layout

0 favourites
  • 4 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • I've stamble upon this issue: i've pinned 2 cannons and an engine to a space ship so i can change the graphics when the ship will be upgrade. No matter what type of controll i use (in this moment i still use the "drag controll" on a touch screen), when i drag the ship to the edge of the layout, these objects go through it. Everything is set with the behaviour "bound to layout by edge" but only the ship stay.

    How can i solve this?

  • One of the ways to fix this is to add an invisible sprite ShipBase. This will be the object that player will be controlling, so move Drag&Drop behavior to ShipBase sprite. Also move the "Bound to layout" behavior to ShipBase. Set ship position to ShipBase on every tick.

    When you attach other parts to the ship, adjust ShipBase size accordingly, so it would always cover the entire ship.

    .

    If your ship is irregular shape (not rectangular) and it can rotate, then the above method will not work. In this case it may be easier to add several frames/animations to the ship sprite for different ship configurations. For example, first frame for ship with no attachments, another frame for the ship with attached weapons, another frame for the ship with attached engine, another frame for both weapons+engine attached. The image in all frames can be the same, but the size of the frame and collision polygon will be different.

    Here is an example:

  • Maybe the "several frames" method is the best solution. Thanks for the fast reply!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've stamble upon this issue: i've pinned 2 cannons and an engine to a space ship so i can change the graphics when the ship will be upgrade. No matter what type of controll i use (in this moment i still use the "drag controll" on a touch screen), when i drag the ship to the edge of the layout, these objects go through it. Everything is set with the behaviour "bound to layout by edge" but only the ship stay.

    How can i solve this?

    the collision box of ship as suggested above works fine. you should follow that. i tried doing a custom limitation by coding and position replacement but they don't work well with drag and drop instead u would have to use touch plugin. and they do some jerkins on edge hit. here is a capx with the above mention collision polygon example. example

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