Challenges rolling my own platformer

0 favourites
  • 6 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • Hi there, I know there is the platformer behavior we can add to an object to give us basic mario style gameplay, but I'm looking to make something that would deviate from that and would like to have full control over movement.

    Does anyone know if there is a tutorial that isn't for beginners? I see videos for construct but they all pretty much are intro videos and from what i saw all relied on the platformer behavior.

    I have made a decent first stab at it rolling my own but using physics in a way that is both dynamic and controlled is proving to be challenging.

    the platformer has nice things like acceleration and max speed settings which are great, but would love to be able to see under the hood of that behavior to see where things might be changed when needed.

    Thanks,

    Caleb

  • is there something specific that you want your platformer to do?

    often most things can be achieved with combining bullet, 8-dir and platformer. You obviously need to enable/disable behaviors in the process depending on what you are doing.

    For example I once used the platform behavior for the gravity and "on landed" trigger alone. And used a completely different movement type for normal movements.

    Another example is combining bullet with 8-dir or platformer. Both enabled at the same time can make a cool kick-back effect if you set the bullet speed to 800 and accel to -1600. Bullet will essentially "shut off" when it reaches 0 since that behavior cannot go backwards.

  • I mean you don’t have to use behaviors at all. The collision detection and response would be the most complex to deal with though. It just depends on what you’re trying to do.

    Here’s an example for handling the horizontal motion utilizing physics. I used the joyx variable to handle the left right controls, because if they are both down they will cancel. If nothing is pressed or they are canceled then deceleration will be applied opposite the velocity. If instead only one key is pressed an acceleration will be applied in that direction. For faster turning the deceleration is applied too if the velocity is opposite the direction you want to go. I used a math trick a*b<0 if a and b have opposite signs. Finally the max speed is enforced by clamping the velocity.

    Global number joyx=0

    Every tick

    — set joyx to 0

    Left key is down

    — subtract 1 from joyx

    Right key is down

    — add 1 to joyx

    Joyx = 0

    — xvelocity>0

    —— apply force -deceleration

    — else

    —— apply force deceleration

    Joyx <>0

    — apply force joyx*acceleration

    — compare: joyx*xvelocity <0

    —— apply force joyx*deceleration

    Every tick:

    — set xvelocity to clamp(xvelocity, -maxspeed, maxspeed)

  • That's awesome, yea i do see that making sense. I'm going to experiment with your suggestions and see what i can come up with.

    on the one hand i kinda don't like using physics to move the guy around, but on the other hand i don't see how i could ever jumping without it. My math skills are not the best and I suspect it would get kinda deep moving a character around (like mario) and it be both fluid and controlled.

    I mean what i'm trying to do isn't so much revolutionary or anything.. but like i wanted to do a dash move for example.. i need to also manage a fairly complex number of animations. I am working with a good artist so he's cranking out some good animations and I'm trying to make sure that everything moves and behaves in a way that the art blends with..

  • a dash works great with platformer combined with bullet. With both enabled...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you can also use "Set Vector X" to do a dash (it is limited by the max speed, so you would also have to increase max speed for the duration of the dash).

    platform can do just about anything and handles a lot of the work for you. You can turn off gravity, change the angle of gravity, and lots of other things to achieve whatever you want...

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