Destroy an object at a point

Get help using Construct 2

Post » Sat Oct 15, 2011 12:03 am

Hey again. I'm really loving Construct 2, and I'm having lots of fun learning how to use it, but I'm afraid I've reached a rough spot again, nothing I do seems to quite work. I'm curious as to how I would make it so when you jump. You destroy lets say... A block from underneath, like in Mario, but if you jump ON TOP of it, it doesn't get destroyed.

Thanks in advance!
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Sat Oct 15, 2011 12:20 am

Couldn't you do that with actionpoints, so you have 1 on top and 1 on the bottom, and when it comes in contact with action point 2 it destroys..? i dunno really just throwing an idea your way.
B
40
S
14
G
11
Posts: 243
Reputation: 9,432

Post » Sat Oct 15, 2011 12:23 am

Action point? Is that different from image point? I kind of figured out one way, but I don't like it that much. I have an image point at the bottom, and a small invisible bar that spawns on it. Once the player collides it breaks the block. BUT... for some reason it destroys all the blocks, not just that instance. Even though I have an instance variable (Bumped) that sets it off.
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Sat Oct 15, 2011 12:30 am

EDIT: Didn't check for new posts before I posted, I see you basically have the same thing already. Your problem with all blocks getting destroyed is that the event isn't picking them properly, usually due to how you set up events -- if you post your .capx, I can help you more on that.

First, you want to make the block solid. If you don't know how to do that, click on the block in the bottom right in the object list, then add "Solid" as a behavior in the panel on the left.

Next, you'll have to make a small invisible sprite following your player. It'll serve as your little "detector"; since two solid objects can't overlap each other, you need something that isn't solid to detect collisions. Have an "Every tick" event that sets the detector's position to your character's X and the top of their sprite (either figure out what that is manually, or say "Player.Y-(Player.Height/2)", since Y is their center).

Now you can detect collisions between the detector and the block. So on collision between Detector and Block (you can also test to make sure your player is jumping), destroy block.

This is what I do and works perfectly, hope my explanation was good enough!SullyTheStrange2011-10-15 00:32:53
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Oct 15, 2011 12:46 am

Sure, here you are.

http://dl.dropbox.com/u/45478479/APA.capx

Warning, it's quite hilarious.
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Sat Oct 15, 2011 1:03 am

Hilarious indeed.

http://db.tt/cVSAsruW

Ta-da! I added two simple things to make it work. First, a variable for Collision called "ID", which you set to the BlargBlock's UID after spawning it in the start. Second, a condition for the collision event that specifies that it only picks the BlargBlock whose UID matches the ID set to the Collision bar -- that way, only that block disappears rather than all of 'em.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Oct 15, 2011 1:32 am

Thanks a ton, I appreciate that!
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Sat Oct 15, 2011 4:47 am

Alright. SO, I've got it kind of working how I want it. But... It all went down hill when I started adding more of my monsters!!

http://dl.dropbox.com/u/45478479/APA2.capx

If I could get another hand. That would be great.

p.p.s. It's just that much more hilarious now.Crayron2011-10-15 04:59:20
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Post » Sat Oct 15, 2011 5:53 am

http://db.tt/51KuGhLu

Alright, this took a while to sort out... At some point I just threw out a lot of it and redid it a different way. Rather than each enemy having a collision detector, I put a single one on Alex's feet -- that gets rid of the problem of trying to keep each one on each enemy. As for the two guys on the right walking straight into the pit... well, I have no idea why that was happening, but if you take out one of the two, it works fine. Hopefully someone else can come in and explain that.

Now, I gotta ask... where are these sound effects coming from? I get the feeling you're recording them yourself. Music's great too, did you make that?
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Oct 15, 2011 6:21 am

Hahah. Music I stole from Kirby. Sounds I made. The Noises Alex makes, were recorded by my cousin, Alex. XD And the other noises, Brick/Death of the Devil are me.

I'm just trying to make a quick, easy game to learn the program, before I go and do anything too complicated. Thanks again for your help man!
B
16
S
3
G
2
Posts: 57
Reputation: 2,078

Next

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, mjj1990 and 7 guests