Ceiling Grab (noobish question)

Get help using Construct 2

Post » Thu Feb 23, 2012 7:15 pm

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!

/CliffCliffman2012-02-23 19:15:36
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Thu Feb 23, 2012 7:46 pm

Error when opening the file, you'll have to save the project as a single file - .capx
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Thu Feb 23, 2012 8:57 pm

Oops! Sorry 'bout that. :)

http://dl.dropbox.com/u/12077257/testproject.capx?dl=1
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Fri Feb 24, 2012 3:05 am

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
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Fri Feb 24, 2012 9:31 am

Cool! That's a pretty smart solution to the problem!   
Thanks a lot, Noga!
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Fri Feb 24, 2012 10:19 am

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

http://www.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.TELLES08082012-02-24 10:21:47
ImageImageImageImageImageImage
B
93
S
20
G
12
Posts: 1,211
Reputation: 18,480


Return to How do I....?

Who is online

Users browsing this forum: fredriksthlm, MPPlantOfficial, Yahoo [Bot] and 16 guests