Scroll tank into view

Get help using Construct 2

Post » Wed Dec 05, 2012 3:20 pm

I have a wide layout and I would like my enemy boss tank scroll into the layout when my ally tank gets to the edge of the screen.

Any ideas how to do this? I looked for examples, but none found.


Thanks for any help.
B
31
S
16
G
11
Posts: 450
Reputation: 9,721

Post » Wed Dec 05, 2012 3:24 pm

You could set a check on the players position.

If allies.x (trigger once while true) > 800 = Set Enemy_Tank Local Variable = 'move'
While Enemy_Tank Local Variable = move   = simulate pressing left
After 2 seconds set Enemy Tank local variable = 'stop'

Without knowing more information I can't offer much more help. I hope this helps
B
13
S
2
Posts: 87
Reputation: 1,244

Post » Wed Dec 05, 2012 3:36 pm

It's a side scrolling game. I guess you would call it that, the layout is 3840x1024, and the player tank must maneuver to the left through obstacles and enemy tanks.

As the player tank gets near the end of the layout I would like the boss tank to scroll into view from the right just off the layout, just in front of the player, say 1 pixel every 0.5 secs.

Thanks for the reply.
B
31
S
16
G
11
Posts: 450
Reputation: 9,721

Post » Wed Dec 05, 2012 3:49 pm

Here's something I did recently.



Someone better than me at C2 can probably provide a better way of doing this, but here's an explanation of what I did. As you can see, I created a trigger (a colorless, invisible sprite) that at once deactivated the cam and did two other things, one of them activating the boss. The boss was placed on the outside of the layout, and the instructions in the "Boss Setup" reflect this: I set its speed, had it move left (I used platform behavior for it, you might not), had it wait X time then resumed its movement ("movement" in my case is different, since I cannot give it preset pathfinding based on simulated control alone, so I deactivated simulated control and set it to move along an horizontal Sine wave - he's at sea so the wave behavior is a plus).

bergmark2012-12-05 15:50:17
B
8
Posts: 24
Reputation: 638

Post » Wed Dec 05, 2012 4:03 pm

Cool, thanks.

You actually answered another question I was going to ask at a later time about how to handle sound FX. I guess the the sound FX for a tank shot would be the same as the "play heavy music" audio event.

Thanks, bergmark.
B
31
S
16
G
11
Posts: 450
Reputation: 9,721

Post » Wed Dec 05, 2012 5:39 pm

You're welcome, though it would be interesting to see someone else's take on this as well.

As for sound, Construct 2 seems to be picky when it comes to stop playing sounds. While playing a sound on command (ie., press key to fire a shot and play a sound) works fine, music requires the use of the Tags field. In this way, when you tell C2 to Stop playing audio, the "Music" tag means it will stop playing the music currently playing. For some reason, I don't need to do this for standard Audio (sound effects).
B
8
Posts: 24
Reputation: 638


Return to How do I....?

Who is online

Users browsing this forum: jeffige, Mallets and 25 guests