Item Box in Platformer Game



  • This post is deleted!

  • Admin

    Please don't create a new topic for the same question as your last one.
    If you replied to your previous post it would have been bumped up.



  • @Ricky Some things I've noticed are that you are using huge graphics, some of your graphics have a lot of blank space, and you are using a lot of collision points. You should crop away the blank space and resize the images using an image editor, rather than setting a small scale in hyperpad. You should try and resize the images so they can stay around 100% in hyperpad. That should also help reduce the file size and loading times; 50mb is huge for a hyperPad project.

    I don't know how much collisions affect the performance, but I'd try to use less points. Generally, you can make enemy collisions slightly too small and powerup collisions slightly bigger, so the game doesn't feel unfair. I think real Mario games do this and just use rectangles for their collisions.

    For the "mushrooms" I'd suggest having just one mushroom somewhere off screen, then destroy it from another object's behaviours at the start of the game, then when the player hits the powerup block, use the 'Spawn On Object' behaviour to create a mushroom above it.



  • @Jack8680 thanks for your help. I tried what you said about the mushrooms, and even though I have the mushroom as a physics object, it continues to defy gravity and act as a physics object. I don't know if it's just a bug or something wrong with my code. Thank you for your help. Here's the code if you want to see it: http://bit.ly/2rb3oi6



  • @Ricky oh, I don't know whether the patrol behaviour is meant to work with physics. I'd set the friction of the mushroom to 0 and use the set velocity behaviour instead. Also, if you use spawn on object you only need to add the behaviours for one mushroom.



  • @Jack8680 I think patrol can be affected by physics.....for example, if an object hits the patrolling object it gets pushed and patrols a different spot. Maybe making it a wall object would fix that?


  • Admin

    Patrol and physics are kind of weird.

    The patrol over rides physics to make the original movement, but if something hits the object moving, it will shift it it's new position and continue to patrol.

    This can be seen for example if you make an object patrol if it's off the ground. It won't drop with gravity, but if something falls on top of it then it will hit the ground and continue to patrol.



  • Interesting. If you want it to reflect off objects you could set the velocity when it spawns, then put all the objects you want to reflect off in a tag and then use the collided behaviour with the tag selected and either multiply the x velocity by -1 and set to that. Or use collided on left, set velocityX to positive value; collided on right, set velocityX to negative value.