Scroll tank into view

0 favourites
  • 6 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • 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.

  • 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

  • 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.

  • Here's something I did recently.

    <img src="http://s11.postimage.org/ipufah8ur/Untitled_1.png" border="0" />

    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).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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).

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