Need a bit more help

Godot Version



okay so this is sorta a continuation from trying to get the enemy to move, now im struggling to get Spot and Kyran to actually take damage, could someone help pls

Please provide more details. The forum isn’t setup to easily find your last topic.

Code snippets pictures and videos are helpful.

give me a second


1 Like

So, looking at your previous post it seems that the player objects are sprites? or have they been updated to a CharacterBody2D? I didn’t find out.

if they are just sprites you can add an Area2D as a child to the sprite(for the players and enemies), and you can use the body_entered signal to sense when the enemy and player touch.

if they are CharacterBody2D, then you can test for collisions every frame and see if it is ever with an enemy class.

once the collsion is detected you can check if its with an enemy class with something like this:
if collided_body is MyEnemyClassName: DoDamage()
this requires a class_name declaration on the enemy class script.

1 Like

they are sprites, and ive tried using body_entered, it did nothing for some reason

Oh sorry I think it will be area entered signal. But also since it is not a character body, you will have to do something fancy to check who the parent is.

And I had a better idea use a special collision layer for the areas that only enemies are part of. This could guarantee only enemies are detected and you can just do damage without checking the class.

ill try that when i get back to working on it

okay im back to working on it, how exactly would i do this?

You said the game is Mario brothers like. Like old school side scrolling and platforms? If this is true are you really not using a characterbody2d?

how do you do movement and collisions with obstacles with your sprite?

Could you clarify before I give you a guide to something that you may or may not need?

the mario and luigi series is what im taking inspiration from

1 Like

Ah okay a turn based fighting system.

Forget what I said before.

In my mind you have a turn system that prompts the player and invoke the enemy actor moves.

The turn system will invoke the enemy to make a decision, If the enemy decides to attack it will play an animation and a hit effect.

But the player can time a button press to minimize damage.

Since the animation will have a moment where the player can block. Maybe the turn manager needs to start an animation and time it for the player block input to then decide the damage value.

This becomes very complicated unless you already have a system in place or an idea in mind. Do you have any design diagrams for your current system?

wdym design diagrams?

My platform test game was partially inspired by old school platform games.

I got it to a playable state and released it to :smile:

I mean something like this, no code, just concepts and ideas to compartmentalize the different aspects of the game. This is an example based on your project.

This picture is incomplete as it focuses on a computer turn and it is only an example of attacking. What if the enemy wanted to heal an ally or itself? What if its the players turn? how would I manage the UI selection for actions?

In my vision for what is happening there are 6 steps and then it repeats.
1.Get the character who’s turn it is next
2. (if computer enemy) get decision for action, (if player show action UI)
3. (computer) make internal decision (attack)
4. (attack action) choose a random target for action
5. make character do its action with the target
6. play animation

There are many systems that can be made, and lots of finer detail isn’t present. I want to know your requirements for how it should behave and what you may want to happen.

1 Like

to focus on your problem how do you manage the characters?

I know i said this before, then i said forget it, now that i thought about it more, I think maybe having characterbody2D for the entities will make it easier for the counter system. (when mario/luigi jumps to counter an attack). It would be really easy to play an enemy attack animation/tween/spawn projectiles, and what not, then have the user jump and land on a hitbox to do the counter move.

if the projectile hits luigi’s main hitsbox he takes damage. if luigi’s feet hitbox hits the bullets hitbox a counter move is performed.

Maybe using sprites can work too, it just makes the hitbox collsion detection maybe a little more tricky? maybe not, since characterbody2d supports one collision shape by default and we probably want two so it wouldn’t matter much either way i guess.

either way after a damage collision you update the characters health and signal to the UI.

this can be detected with Area2D signal area_entered (if we use sprites and areas only)

func _on_main_hitbox_area_enter(area):
   health = health - area.damage 

func _on_feet_hitbox_area_enter(area):
      <do counter>

so i should try using character bodies instead of sprite 2ds

also would i need to rework anything to do this or no

I have no idea! that’s what I have been asking. I don’t know what your code is like.

Here are my past questions.

  • do you have any designs and requirements?
    • (requirement: should be like the Mario Luigi series)
  • what is your current turn system?
  • how do you manage your characters?

Please answer these and explain your game to me.
(the more detail the better. :blush:)

currently i dont have a system to handle turns, nor enemy moves or player moves