How do I create a zipline or DK Barrel Blast (move A to B)

1 favourites
  • 11 posts
From the Asset Store
********* 2D top down barrels game assets *********
  • Hello all! I'm trying to recreate this kind of behavior or effect. Something like the Donkey Kong Country SNES barrel blasts that moves the player in a direction for a certain amount. Or a zip line effect like in Metroid: Zero Mission. Or imagine Far Cry 3, ziplining down from a tower to the forest ground! Something that takes the player from point A to point B.

    https://youtu.be/BrA23yJ10Ng?t=174

    Video of the zipline in Metroid: Zero Mission

    So I've only just started trying to implement this. I'll add a capx of my work when I've got more solid stuff. Right now, I'm curious on how I might do this effect and I'd appreciate any tips. I'm sure there are probably many ways to replicate this. Currently, I'm trying to use the plugin behaviour MoveTo to move the player horizontally 200 pixels for 2 seconds. It's looking a bit wacky. I also found this tutorial that seems like it might be useful to me so I'm going to examine it after work.

    https://www.scirra.com/tutorials/1367/a ... -waypoints

    Anyway, I'm wondering how I can recreate this effect and if there's an easy way to do it. Thanks!

  • The barrels would just be sprites with their own Sine behaviour. Once the player is overlapping a barrel sprite, set player invisible and set player.X/Y to barrel.X/Y. You'll need to update the player's position to the barrels position as the barrel moves. Disable player controls and anything else you don't want happening while the player is in a barrel. There are a few ways to do this, play around a bit. Also set a variable that you are in a barrel. inBarrel = 1

    When inBarrel = 1 and you press the Fire Key, enable bullet behaviour on the Player and set inBarrel = 0. Set the Player's animation to "Curled Up" (or whatever) then set the bullet acceleration/speed and time that this animation will play, based on each barrels properties. Also set the Player back to visible.

    Disable bullet behaviour after X amount of time. Set the animations back to default. Enable player controls. Rinse and repeat.

  • Thanks so much for the help Tekniko! You explaining the steps really helped! So I'm beginning with a zip line type effect for now. Barrel effect will come after. I've run into some issues creating this though. Gifs and Capx included. A,D, space to control.

    I'm experimenting with two different ways of creating the zip line effect. One way is a Pin/UnPin and the other by setting the position of the player to the zipline Every Tick. I can't get this second way to work properly. The player disappears during the "ride" from a to b. Can I fix this?

    Set Pos Every Tick

    PIN

    Also, I'm confusing myself trying to make this thing go in reverse. I need the player to be able to move back and forth on the zip line. This is breaking for me. It works on the pin/unpin version but it goes crazy. It flips my player collision upside down. I know what I'm doing wrong in the Set Position Every Tick version but I'm not sure how to get around it. I'm creating some sort of infinite loop before even using the zip line causing it to move by itself.

    Anyway, am I laying out the code correctly for this in general? Should I be using more functions? I want it to look like my character is actually hanging on to the bottom of the "zipline" with his hand. I guess I'd have to create some sort of extra sprite overlapper that spawns on my player's hand during a jump so I can check if it overlaps with the zip line? If the player's hand overlaps with the zipline, then set the player sprite to certain image point and begin the ride?

    https://www.dropbox.com/s/r3p8ic5kcuij8 ... .capx?dl=0

    edit: i thought what might have been making my collision weird was the -180 bullet angle of motion but even when set to 180, my player's collision still gets flipped/reversed/trippy

  • I've done you up a working version that doesn't use the bullet behaviour - no doubt there is still a better way to do this, but it seems to work pretty well. You can download from here

  • I've done you up a working version that doesn't use the bullet behaviour - no doubt there is still a better way to do this, but it seems to work pretty well. You can download from here

    I would go with a different method than the exact one you used, signaljacker, because the way you have it would make the zipline move different distances for different framerates.

    heyguy: I've had bullet problems like the one you're talking about before. I would turn the bullet's "set angle" setting to "no" and set the bullet angle of motion to 180.

  • Oops, yes calebbennetts is right - I was not thinking that through...

    EDIT: I've updated the file, it now uses bullet behaviour and a trigger sprite - might still be a better way to do it - seems to be working here though - new file

    heyguy what might be happening in yours is the bullet has "set angle" in the properties which will flip the sprite, it was driving me nuts too until I noticed it's on by default.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like a tutorial I need to make.

  • Thanks signaljacker! Thanks calebbennetts Thanks so for much for the capx examples! They've really helped me think about this in the correct way. I knew I had to differentiate between going left and right. That and "Set Angle" was messing up my player collisions I think. I've got my code working now too so here's another example on how to replicate a zipline! Capx below! It's not as elegant as yours but it gets the job done too. This one has some instance variables that set the angle, speed and time of the zipline and player.

    I've run into a problem with my zipline. You can see it towards the end of the gif above. I guess I might not run into it with signaljacker's zipline. But how do I differentiate between the different instances of the zipline I collide with?

    So I've started creating the Donkey Kong Country cannon barrels <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> How do I set the bullet angle of the player with the angle of a rotating barrel? Take a look at this gif. I don't have the angle of the barrel correct and I'm blasting myself into the ground. Another more complicated question. How do I get it so that the player actually has to jump into and have a portion of his body overlapping with the barrel to "enter" the barrel? Right now, the numbers of the overlap offset confuse me.

    One more thing! I'm also trying to create a rollercoaster-type zipline that moves the player from point A to B (B would be the last point on the path). Here's my attempt. I'm trying to do it without any additional plug ins or behaviors. For now at least. After a bunch of research on the forums, I think I've come up with the easiest solution. I can't get it to work reliably though. What would be the best way to create this effect? Would it be easier using the Rex Spline plug in behavior? Anyway, thanks for all the help folks!

    https://www.dropbox.com/s/ti6m8ohmtcms2 ... .capx?dl=0

  • Made some updates to the barrels and rollercoaster! Everyone will need rex Spline to open this new capx. So the barrels are working a lot more as intended. I've figured out how to get the correct rotation and angle on objects. I'm still having a bug where if you enter the "rotating" barrel from another barrel, the player gets shot straight down. Also, if you shoot yourself up from the rotating barrel and enter it again, you'll be shot straight down. Looking at my code, this shouldn't happen. When you enter the rotating barrel, I set the player bullet angle to barrel.angle. Can anyone take a look and figure out why that isn't working properly. I'll keep experimenting.

    Tekniko Any tips or suggestions on how I'm making these barrels work best? I think maybe I foresee problems with how I switch on and off collisions of the barrels for a moment but I'm not sure. I'm a pretty new at this. I'd like to make a combination of barrel to zipline/vice versa but that is currently breaking. I haven't taken a close look at that yet though. Thanks for looking at my post! Here's my capx. I've also created a small test spline rollercoaster on the bottom have of the layout! Check it out, collide with the ziplineSpline sprite!

    https://www.dropbox.com/s/b68c6jzckv7f2 ... .capx?dl=0

  • Hey all! Created one more zipline behavior for fun! This one is more like a rollercoaster effect! I eventually want to create something like the train car rides like in Donkey Kong Country. Or imagine a 2D version of Bioshock Infinite with the sky rails! I thought DK cannon barrels, ziplines and rollercoaster effects where all kind of similar in a way <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy"> Anyway, so I experimented a bit and I think I've come up with 3 relatively simple and pretty different ways to create movement along a path. I searched ziplines on the forums and saw someone suggested another way to create them. So I'm using bullet behaviors on the player with invisible sprites that change the bullet speed and bullet angle of the player. I'm using the pathfinding behavior, the rex spline behavior and the bullet behavior. I'm pretty happy with how this bullet behavior rollercoaster came out. Just need to add a reverse function now. I want to understand better the other behaviors too.

    Another poster provided me with a rex spline example and I'm modifying it for my purposes. I want to move the player along the spline path when they collide with the object that travels the spline path. When the player collides with the object, they'll be pinned to it and the path function will run. I'm having a few issues. For some reason the zipline object on the path moves right at the start of layout. When it's being ridden, the zipline will actually leave the screen instead of stopping at point B. I'm unsure how I stop the ride and "disembark" the player and end the function. Would a sprite that unpins the character do that? Here's a gif of how the spline behavior is behaving.

    Rotating barrel is still broken. I've added text to capx layout so people can differentiate between what does what and play with everything! Thanks for everyone's help so far!

    https://www.dropbox.com/s/yhsbxeiuz3350 ... .capx?dl=0

  • With the rotating barrel - I haven't had time to look at it properly, but I think that some of the actions in the different groups are overriding eachother - to see what I mean try turning off the Vertical Sine Cannon group, and then hop in a rotating barrel and you can no longer shoot out of it. You could try to test for a collision before running the events, because then construct will use that collision as a reference to which instance to pick - at the moment I think it just defaults to a random instance because on the R trigger it doesn't specifically reference a barrel instance only an instance variable.

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