Ceiling Grab (noobish question)

0 favourites
  • 6 posts
  • Hey there folks!

    I'm just getting started on a prototype I'm going to (hopefully) be using in my game design thesis tests in a couple of weeks and I've run into a small problem.

    The idea is to create a simple platformer where the player controls a small creature that can run to the right and left and jump (no problem there). The interesting thing is that I want the player to be able to cling to a wall or ceiling and move along it as well. I'm thinking that the player will use the A and D keys to grab on to left and right walls respectively while using the arrow keys to move in the desired direction.

    For this I used the "Platform has wall to left"(/right) and different states (num variable) that are checked on tick by the system and implement different actions depending on state. for example, state 1 means that the player is hanging on a left wall and therefore has left and right arrow inputs ignored, while using up and down arrows to set the platform Y vector to -200 or 200 respectively. This has worked so far pretty all right.

    The problem is when I try to implement something like it to grabbing the ceiling objects I've created. Since there isn't a "Platform has ceiling on top" event, I've had to try and create my own way to check whether the player sprite is right under a ceiling, but it's proven a bit tougher than I expected since I'm so new to C2. It seems that I can't register a collision with a ceiling object when trying to jump up and grab a hold onto a ceiling object (in the attached file, I'm using an image of Master Roshi from Dragon Ball as an indicator that a collision has been detected between the player and ceiling object and/or that the player is in ceiling-hang-state), but there is a collision when the player lands onto a ceiling object (the only horizontal black rectangle in the game).

    I'm probably going about this the wrong way and am making stuff way more difficult than it needs to be (I tend to do that). Any tips?

    I apologize in advance for the messy file. I didn't intend on making it public so it's all a bit muddy and there's a bunch of needlessly confusing stuff (like having block, wall and ceiling be three different objects, for example). Oh, and the green circle is the player figure (placeholders everywhere, it's not pretty).

    Project File

    Any help and/or guidance would be appreciated!   

    Oh, and I searched the forums for this before starting to write this (of course) but only found a solution from two years back that I couldn't test in C2 since the files can't be imported, so I figured it was all right to ask here.

    Thanks in advance, forumites!

    /Cliff

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Error when opening the file, you'll have to save the project as a single file - .capx

  • Oops! Sorry 'bout that. :)

    dl.dropbox.com/u/12077257/testproject.capx

  • I've used my method with only spacebar used as sticky key, but basically there is a detector to determine whether the circle is close to a ceiling. You can turn off 1st event to see the detector.

    download

  • Cool! That's a pretty smart solution to the problem!   <img src="smileys/smiley32.gif" border="0" align="middle" />

    Thanks a lot, Noga!

  • I made one sample game with this purpose have around 2 days, just download and watch the code =)

    scirra.com/arcade/example/547/climbing-ceiling

    Also, if you want climb edges, I did a smart solution using detectors, just watch my SandBOX.

    Next month I'll make the climbing a rope and ledge, and then, walking on stairs.

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