Set position to moving object

Get help using Construct 2

Post » Thu Jul 18, 2013 9:22 am

Hi,

I have this silly problem. I'm making this horizontal scrolling game and when the timer is over I want to spawn a 'portal' on the next screen from my sprite. So like Sprite.X+1000 for example. The problem is since my sprite is constantly moving the X keeps changing and the portal always stays at +1000. Any idea how to fix this?

Thanx
B
5
S
1
Posts: 48
Reputation: 496

Post » Thu Jul 18, 2013 9:25 am

seems to me that you just need to spawn it on background layer , not on the same layer as player is.
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Thu Jul 18, 2013 9:33 am

@irina i tried that as well. but since sprite.x keeps changing it keeps moving with it. or maybe i'm doing it wrong
B
5
S
1
Posts: 48
Reputation: 496

Post » Thu Jul 18, 2013 10:06 am

If you spawn the portal at +1000, the portal then should keep its X, not changing it with the players X.
It depends on how you did your wrap, but mostly I don't understand why you change the X of the portal to player.X+1000... Spawning it at this X won't "link" it to the player, the player.X variation won't interfere with the portal.X.
Could you post your capx for better help maybe ?
B
17
S
8
G
4
Posts: 461
Reputation: 6,157

Post » Thu Jul 18, 2013 10:19 am

@Guizmus I can't really post the capx because there is a ton of stuff in there. The best I can do is give you a screenshot of this bit
https://www.dropbox.com/s/wqqc80z71q9gk2s/Capture2.PNG

Basically I spawn the portal on the sprite.X+700 (bluetruck) and then move the sprite toward the portal. If i use set position it will keep moving the portal. If i use create (like in this case) it will keep spawning portals after portals.
B
5
S
1
Posts: 48
Reputation: 496

Post » Thu Jul 18, 2013 10:30 am

how about to add system repeat (1) for creation?
irina2013-07-18 10:31:13
B
26
S
11
G
2
Posts: 669
Reputation: 5,038

Post » Thu Jul 18, 2013 10:37 am

Well, you can always post a sample capx, duplicate of the original with everything removed but what you need help on.

If you just add a condition "once while true" on your event 43, your problem will be solved though. The problem right now is that you don't have a trigger for the portal to appear, you just check if the time has passed. But as once the time has pasted, it has passed every tick, your condition is always true, thus the once while true.
B
17
S
8
G
4
Posts: 461
Reputation: 6,157

Post » Thu Jul 18, 2013 10:58 am

It works! The 'one while true' fixed everything! Thank you @irina and @Guizmus for the support :)
B
5
S
1
Posts: 48
Reputation: 496


Return to How do I....?

Who is online

Users browsing this forum: newt and 10 guests