Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

L14.P2 Reducing damage at higher levels: check rejects correct solutions that don't reassign amount

Closed
#1,388 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
godot

Research direction

Start by locating the L14.P2 lesson and inspect the checks for the damage-reduction behavior, including "Damage Amount Is Correct Value". Reproduce the issue with the shown solution and update the validation so semantically equivalent damage handling passes; done when the valid solution is accepted without breaking the existing checks.

Written by the indexing model from the issue text.

Description

bug

What happened?
I solved the problem with a solution that worked and accomplished everything intended but did not pass the tests. Doing the multiplication by 0.5 at the subtraction rather than assigning the result back to amount fails despite a 10-damage attack still being reduced to 5 above level 2, with full damage below level 3. The second check, "Damage Amount Is Correct Value", passed.

Where were you in the app?
L14.P2 Reducing damage at higher levels

What did you expect to happen?
The test should accept the other solutions that work as intended instead of restricting to certain syntax.

Your code

var level = 3
var health = 100
var max_health = 100

func take_damage(amount):
	if level > 2:
		health -= amount * 0.5
	else:
		health -= amount

	if health < 0:
		health = 0

Optional: screenshot or other details
Image

Dominant language
GDScript
Stars
2.8k
Forks
235
Avg merge
20d 10h
Merged PRs (30d)
1

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GDQuest/learn-gdscript

All issues in GDQuest/learn-gdscript

Similar issues

More Game Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.