All Questions

Community

s
shahnj
posted to: Bumpers (solution)

I approached the solution differently, is that alright?

Hi Nathan,

For the bumper scene, I created the the following scene Tree;

  • StaticBody2D
  • -> CollisionShape2D
  • -> Sprite
  • -> Area2D
  • ---> CollsionShape2D

NB: The arrows indicate how deeply the tree scene is nested.

I, then added the signal and collisions layer for the bumper, and this worked for me!

Is that alright? As I find it more intuitive for the root node to be an StaticBody2D as compared to just an Area2D? Is that appropriate?

Loving the course so far! I've also pre-ordered the Learn to Code with Godot course to learn the fundamentals of Godot Game Dev, as it's quite different to Python Dev.

Thanks in advance!

  • GDQuestions replied

    Sure, it's fine to do things differently.

    Is that alright? As I find it more intuitive for the root node to be an StaticBody2D as compared to just an Area2D? Is that appropriate?

    If you need part of the bumper to collide with the player and block them, sure. That's what a static body does - it's like a wall. So you'll want to do that if you don't want the player to walk through the bumper but instead have to jump onto it.

    Otherwise I'd say there's no need for it, and in general, you don't want to add nodes and code you don't need: as your projects grow, they add up and can affect performance or make your project harder to maintain.