All Questions

Community

Y
Nathan Yungkans

enemy code different again

This is another place where my code is different than what is on screen. Maybe this section was done later in your session and you went back to adjust? I thought I was following along the whole time so I'm not sure why it is different. I'll have to go back and see if I did something wrong. At this point my code looks like this: extends "res://src/Actors/Actor.gd" func _ready() -> void: set_physics_process(false) _velocity.x = -speed.x func _on_StompDetector_body_entered(body:PhysicsBody2D)->void: if body.global_position.y > get_node("StompDetector").global_position.y: return get_node("CollisionShape2D").disabled = true queue_free() func _physics_process(delta: float)->void: _velocity.y += gravity * delta if is_on_wall(): _velocity.x *= -1.0 _velocity.y = move_and_slide(_velocity, FLOOR_NORMAL).y
  • Nathan Lovato replied

    Hi!

    As I recorded this after the rest of the course, I might have made some unintended minor changes to the enemy code, but hopefully they shouldn't affect the assignment.

    When it comes to assignments, what matters to me is the part that solves the assignment. You shouldn't worry that there are some differences between your code and mine as long as the characters are working as intended.

    When it comes to code, there are always multiple solutions to a given problem, sometimes many.

    I'm used to working and teaching at professional level. This course being my first "beginner beginner" course, I made some unintentional changes at times, without realizing it.

    Note that when you share code, you can select your code and click the </> icon in the text editor on mavenseed. It will keep the code formatted.