Tutorial Downloads

File Size
mbCrawlmbGravmbCDash.capx268KB

Translations

Know another language? Translate this tutorial!

Stats

1,262 visitors
3.7K page views

Multi-Crawl/Dash/Spaces Tutorial (mbCrawl, mbGrav, mbCDash)

Favourite 7 favourites
Tutorial written by ZebbiOriginally published on 21st, February 2015

This tutorial will show you how to have a character crouch, perform a crouched dash-slide, remain crouched even if the ↓ button is released when the character is underneath a crawlspace, and all of this works in reverse gravity too.

Setup Platform Character

We will be using a player container with pinned animations, as is standard with platformer games.

Here is our character positioned over a separate fucia container object:
Now we lay them directly over the top of each other:
Pin the character to the box:


The box has gravity normal and (a redundant) flipped anim, as well as crouch normal and flipped.
Open full size image
Open full size image

The only thing that changes is the collision polygon, the origin stays exactly the same for all states of crouch/gravity (important).

Animations and Preliminary Stuff

Take care of character mirroring:


And some anims:
Open full size image

This ternary operation:
...checks if our player is (in this case not) underneath an obstacle. If our gravity if switched, check ("down" relative to us, but "above" our character's head) down 20px for an overlap, or up -20px if gravity is normal.

Crawling and Crouching

This sets the ducking player animations and our crawling speed:

Open full size image

The last condition checks if we are on ground and restores the walk speed.

This is a test for the state of gravity according to the playerobject's collision box animation:


This sets more animations for the player and restores our walking speed if we're not crouching anymore:
Open full size image

Setting the crouch animations (and keeping us crouched even if we release the ↓ key when underneath an obstacle:
Open full size image

Again, more animations and ways to check we are able to stand if we are not underneath an obstacle:
Open full size image

Slides

Here are our ways of calling the slide function:


And here are the left and right slide functions:
Open full size image

Notice how if the character decelerates to the crawl speed, we keep on crawling at that speed rather than decelerating any further.

Jumping

Here are our jump conditions, but we don't jump if we are underneath an obstacle, rather the slide conditions will take care of that (this is for both states of gravity) and also to keep jumping if space is pressed when we land:


Gravity

Here are our gravity object collision animations and player animation conditions. It also takes care of all of the gravity changes and returns to normal after a predetermined time:


And that's it, have fun!

Unlock your full gamedev potential

Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.

Comments

0
DylanHuber 1,093 rep

Super helpful Thanks!!!!

Friday, September 23, 2016 at 6:49:51 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.