Parallax Problem

0 favourites
  • 7 posts
From the Asset Store
Set of 10 Parallax Background to make pixel art game.
  • It is a side scrolling game where the player has to drag and drop buttons to maneuver the player.

    I am using a parallax layer with drag and drop buttons on it.

    Whenever the button is dropped i change its layer to another layer so that it does not move with the parallax layer.

    Whenever i drop the buttons, they automatically go back inside the main window size, but i want it to stay wherever they are dropped.

    My window size is 1920x1080 and the layout size is 6000x1080.

    How do i make them stop wherever they are dropped.

    Thank You.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In my opinion you should look for other solutions, don't just stuck to one solution, there may be other ways.

    Reason dropped item changes its position is related to layer change of course.

    I have never use drag-drop feature but, did you try something like these;

    You can try having a global variable for it, like when mouse over item it changes to 1 or when you drag an item it changes to 1 i don't know. And you can drag items only when that variable is 1.

    Just don't change layers it will be a problem, if different layers have different parallax, items will change position whenever they change layer, they even get out of the screen, i suggest you find another solution.

  • In my opinion you should look for other solutions, don't just stuck to one solution, there may be other ways.

    Reason dropped item changes its position is related to layer change of course.

    I have never use drag-drop feature but, did you try something like these;

    You can try having a global variable for it, like when mouse over item it changes to 1 or when you drag an item it changes to 1 i don't know. And you can drag items only when that variable is 1.

    Just don't change layers it will be a problem, if different layers have different parallax, items will change position whenever they change layer, they even get out of the screen, i suggest you find another solution.

    the reason why i am shifting the layer is because if i make it stay at the same layer it stops at its position but as the screen keeps moving, it also moves ahead because its in a parallax layer.

    and the variable option you gave, is something like i am using when icon dropped, disable drag and drop for 5 seconds then destroy it and then enable drag and drop again by spawning it at a location at the parallax layer.

    but my main problem is still there, i want the icon to stop dead at a place, if anyone has an idea, please help.

    thank you!

  • When you select the buttons on the properties bar have you set them to global in the operating layer? Probably a given but still may be missed.

  • When you select the buttons on the properties bar have you set them to global in the operating layer? Probably a given but still may be missed.

    this i did not know, that i have to set it to yes, but after doing so, i still have the problem as the car moves out of the initial window size, the buttons are again teleported inside the window size, instead of stopping at the dropped place on another layer.

  • now i tried instead of changing the layer when the object is dropped to when the dragging is started then itself i have changed the layer and rest of the commands i have kept at the object drop event, and now it works perfectly.

    thank you everyone for helping, i think the change in the global field also helped, thank you.

  • https://www.scirra.com/tutorials/594/bu ... terface-ui

    This one here might be of some help to understand the whole thing about layers and global and such. Glad to heart you fixed the problem.

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