Mario type hit Blocks

Get help using Construct 2

Post » Sat Apr 07, 2012 6:36 am

as the title say's I'm trying to setup Mario hit blocks,
you know the type of blocks/bricks you hit and they bounce upwards and release a coins above.

I tried,

- Block on collision with Player
- Block.Y < Player.Y - Spawn on object (coin)
                      - set visible (coin)
                      - Destroy (coin)
                     
This doesn't work @ all I've tried Block.Y greater than, less than, etc...
if I hit the block from the side while jumping it destroys?

I can't seem to get the coin to pop up above the block either, I want it to pop up above the block.

B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Sat Apr 07, 2012 7:57 am

What happens is that you create the coin, then immediately destroy it.

Create a little animation for the coin where it bounces up and such, and do something like this.

+ Player is jumping
+ Player collides with Block
- Spawn coin
- Coin: Play animation "bounce"

+ Coin animation bounce is over
- Destroy: CoininkBot2012-04-07 07:58:33
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Sat Apr 07, 2012 8:24 am

I did something similar to this with a custom movement behavior, let it move up for half a second, and back down for half a second, then destroy it. Also, adding a wait between the set visible and destroy will allow it to appear on screen for a noticeable length of time.
B
9
Posts: 59
Reputation: 997

Post » Sat Apr 07, 2012 8:26 am

@inkBot @Greg Thank you for your quick feedback, But I still need the block to not detect the collision from the side just the bottom. thxErndog2k2012-04-07 08:27:35
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Sat Apr 07, 2012 1:17 pm

i think this is what you wont


try: hit me baby

capx

edit: you can play with distance from center of box..the way I set it is that Player X must be iniside box width...or use different sprite attached to players head and check for overlaping instead of collision so you can hit two boxes at oncepodpathos2012-04-07 13:44:37
B
12
S
2
G
2
Posts: 96
Reputation: 1,583

Post » Sat Apr 07, 2012 1:25 pm

You may set a "focus" for the block and make sure that the event occurs when the player hits the focus



If the player reaches the block from the sides or from above he won't be able to touch the "focus"
B
3
Posts: 7
Reputation: 339

Post » Sat Apr 07, 2012 2:22 pm

this is simpler an I think 100% working example: on collision check if angle(Player,Box) is less than zero and image point at players top most pixel is greater than boxY+box.height/2

try

capx

edit: update files. now is perfect - added one more condition: Player Y velocity is less than zero or is not falling.

edit 2 : updated files (again). You dont need to calculate angle with "is not falling condition" added...now is perfect   
podpathos2012-04-07 17:51:24
B
12
S
2
G
2
Posts: 96
Reputation: 1,583

Post » Sat Apr 07, 2012 4:36 pm

@Puffolotti @podpathos Thanks alot for your help I will try these and post back my results thank you alot for your help.

P.S @podpathos I lol'd wen I saw Mario hitting Brittney Spears.Erndog2k2012-04-07 16:38:30
B
27
S
11
G
1
Posts: 246
Reputation: 5,048

Post » Mon Aug 10, 2015 3:30 am

Can this method work for spike damage too?
B
10
S
4
G
1
Posts: 159
Reputation: 1,933

Post » Mon Aug 10, 2015 6:33 am

Codeman320 wrote:Can this method work for spike damage too?


@Codeman320

Erndog2k hasn't been on the forum for over 2 years so is unlikely to answer.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,844
Reputation: 48,289

Next

Return to How do I....?

Who is online

Users browsing this forum: armaldio, plinkie and 18 guests