How do I properly create an instance to another instance?

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • System Instance Create at Player.X and Player.Y works properly until you scroll away from the original area.

    The game window is 640x480. Once you go further than 320 and the screen scrolls with the player, the whip you create starts to get created further and further to the right of the player based on how far you have scrolled away from the starting point. So, say you scroll to 336, the whip is created to the player but an additional 16 pixels away.

    I've tried pinning.

    I've tried to continually setting the whip's position to the player's position.

    Nothing works. I've opened examples of other simple things with scrolling and my code is no different than theirs, yet my whip continues to get created further from the player the more you scroll away from the original starting location.

    Kinda irritating as literally every other game engine(RAD and APIs), all I have to do is create an instance at the player's x and y. Nothing else. Don't understand why it works fine until the screen scrolls. It is created at the same layer as the player. The origins are correct. I just don't get it.

  • Can you post a simple step by step on how to simulate your problem so I may replicate the problem and see what happens.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Post what? It is literally a single line Create Object at Player.X, Player.Y) That is all. It works until the screen scrolls then for unknown reasons it no longer creates the object at the Player.X but at like Player.X + amount screen has scrolled

  • Not sure I am following you but are you using On Every Tick to scroll to the player?

    Every Tick: Scroll to Player

  • Sounds like you are creating on the wrong layer. Parallax is kicking in.

  • I was able to recreate the situation and it all worked fine. Make sure to use update every tick and create a layer so your player and whip are not on the background layer. Great answers lamar and blackhornet.

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