Keeping player, gun, and camera from layout to layout.

  • I have a player sprite, a gun object that rotates around the player, with a crosshair that follows the mouse, and a camera object that follows the player. Everything runs every tick. And all objects are Global. Works fine in the first layout, but after i change layouts, to say level 2, my player is invisible and i have a second set of crosshairs and player running around, one thats visible but isn't attached to the camera.

  • So it's a guessing game? Level 2 probably has fewer layers so the player moves to a lower layer and is behind objects. The extra objects are either because you added them in the level 2 layout (you shouldn't if objects are global as they continue through), or you have logic that creates the player and crosshairs 'on start of layout' which you also don't need if the objects are global.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I checked if I had any "on start of layout" with my player, I do not see anything like that. I do have an Bank Layout that has only objects like my camera, bullets, player sprite, and cross hair, I made all the layers similar to my first stage layout but double player and cross hair still persists.

    This is my current level one to level two Event Logic. The camera kinda goes in between the two players that appear in the second level. I have a small prototype that moves the player from layout to layout like this and it works fine, no second player sprite appearing, I am not sure where the differences lay.

    + obj_player_mask: On collision with OTriggerWest

    -> System: Set PreviousMap to 01

    -> System: Go to Layout 1

    -> obj_player_mask: Set position to (672, 224)

    -> obj_gun: Set position to (672, 224)

    -> obj_camera: Set position to (672, 224)

    -> obj_cursor: Set position to (672, 224)

  • Adjusting the layers to be consistent was only a possible fix for the player appearing behind objects, is that fixed now? You didn't mention it. The extra objects appearing, there is probably a simple reason but it's only speculation without seeing the file.

  • Would the Object Bank Layout effect the duel player problem? Should i have all the same layers there too?

  • If you go to the layout during runtime then yes.

  • No, the player does not go to the Bank Layout, it is just a deposit for sprite objects, like bullets, and enemies which will be created on start of layout for the actual game.

  • I got it working where the player, camera, and cross hair all switch from layout to layout! I used Global Variables to keep track of the player X and Y spawn points.

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