Mario type hit Blocks

0 favourites
  • 10 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • 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.

  • 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: Coin

  • 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.

  • 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. thx

  • i think this is what you wont <img src="smileys/smiley2.gif" border="0" align="middle">

    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 once

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You may set a "focus" for the block and make sure that the event occurs when the player hits the focus

    <img src="http://img848.imageshack.us/img848/8400/focusr.png" border="0" />

    If the player reaches the block from the sides or from above he won't be able to touch the "focus"

  • 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 <img src="smileys/smiley18.gif" border="0" align="middle"> : updated files (again). You dont need to calculate angle with "is not falling condition" added...now is perfect   <img src="smileys/smiley4.gif" border="0" align="middle">

  • 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.

  • Can this method work for spike damage too?

  • 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.

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