How do I properly create an instance to another instance?

Just started using Construct 2? Post your questions here

Post » Mon Feb 20, 2017 2:56 am

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.
B
3
Posts: 2
Reputation: 179

Post » Mon Feb 20, 2017 3:30 am

Can you post a simple step by step on how to simulate your problem so I may replicate the problem and see what happens.
B
17
S
7
G
8
Posts: 18
Reputation: 4,870

Post » Mon Feb 20, 2017 4:02 am

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
B
3
Posts: 2
Reputation: 179

Post » Mon Feb 20, 2017 11:15 am

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

Every Tick: Scroll to Player
Banned User
B
28
S
7
G
58
Posts: 1,229
Reputation: 34,830

Post » Mon Feb 20, 2017 3:32 pm

Sounds like you are creating on the wrong layer. Parallax is kicking in.
ImageImageImage
B
71
S
22
G
258
Posts: 3,792
Reputation: 143,200

Post » Tue Feb 21, 2017 12:19 am

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.
B
17
S
7
G
8
Posts: 18
Reputation: 4,870


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 6 guests