[Solved] "Start New Project from template* - platformer

Hi all

I am an artist rather than a game creator but I am very interested in making some simple games which is how I found GDevelop.

I am using GDevelop5 0.0.0 79Beta
This is regarding the Start New Project from template - platformer

Complete beginner question but I want my player to die when on the floor and in contact with the enemy and to respawn at the beginning as well as being able to kill them (a la super mario)

At the moment the player dies on impact (any impact) and respawns
he can not however not kill the enemies

If I remove the “Delete on collision” then he can stomp and kill the enemy but will not die on contact…

Thanks for a great tool and for all the useful documentation

Help please
Krs

Hi and welcome,
You cannot make “is falling” a sub-condition of “is on floor”, it doesn’t make sense.
Make a line “is in collision” and make two sub-events of that line: one “is on floor” for dying, and another “is falling” for killing/scoring.
Also, your “for each” loop just adds 50 points for each Enemy present on the scene. I don’t think that’s what you want. Move the action to the “is falling” batch of actions.

1 Like

Welcome :grin:

To control player health, you might find it easiest (in the long run) to set it up as variables. That way you can define separate damage amounts per enemy and contact with the floor, as well as healing items.

To respawn at the beginning, you’ll need something like:

Condition: Variable health.current of player is ≤ 0

Note:

  • This is an object variable, a global variable may be more suitable for your game if you want to keep the same health across all scenes. If you want the health to be different from scene to scene, you should use scene or object variables.

Action: Change the scene “name of current scene”

You can add other actions and use other variables too if you want to control whether the player starts with less health after respawn.

Damaging enemies will be a whole different set of events.

Thanks guys for the quick answers. @Phenomena I will definitely start working on the health variables but need to get over this, seemingly very basic problem first

@Gruk Thanks for the explanation
I created one Player collision event and then two sub events as you suggested (ignoring the 50 points for now) but same result
Enemies die when I jump on them but Player doesn’t take any damage…

Are you sure about these two?
image

Also, you don’t need to use collision sub-conditions, since you already have it as a parent condition.
image

1 Like

The player isn’t going take damage when there’s nothing to subtract it from and there are no actions for it, which would be tied to the health system.

Also, you would want to use the change scene action to reset the scene and respawn the player, not pause. :wink: With that, you shouldn’t have to delete the player, but might want to create a death animation instead. This part has nothing at all to do with health variables.

What do you mean with are you sure

Basically what I am doing is opening a new project from the Platform template
In the template there is a section for events called “Enemies Management”

In this section the hitbox is used rather than the player.

All I really want to do is to let the player die when touching an enemy on the ground and respawn using this template.

Thanks again for all your help!

Then simply restart the scene when the player collides with the enemy.

There’s no need to delete the player or hitbox object and as I mentioned above, don’t pause the current scene and start a new one. Do “change the scene”; enter the name of your current scene. That will reset the scene = respawn your player.

Thank you

The simplest solutions are always best ^^

Now I am back to my original conundrum however

The scene now gets restarted when the player touches the enemy → Great
However he can not stomp and kill the enemy (dies anyway he touches them)

If I add the condition *player is on floor" to the Collision event then nothing happens at all (no death and can not stomp)

1 Like

Indeed, you’re welcome :slight_smile:

Check out Gruk’s image where he crossed out the extra collision conditions.

And sorry, my bad, I should have said do the change the scene action to the “is on floor” condition. :blush: If this still doesn’t work, I can try to walk you through using variables to control that - not necessarily health, we can keep it simple.

We have Progress!!!

No both work, I see where the logic was flawed, thank you!

However he now respawns at the top of the screen and stays stuck there…

Yay!

I would remove the “delete playerhitbox” action and replace it with a change of position - put him where you want in the scene editor, then you can set the X/Y coordinates for player.X(); player.Y() for the position change.

Problem Solved!

Thanks for giving your time to a beginner like me ^-~

I am pasting a screenshot of how it should look for future reference if anyone is looking

Have a great day
Kris

2 Likes