Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add interactive map to navigate to islands #27

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

audreygentili
Copy link

Add an interactive map scene after the main menu scene.
This new scene lets you navigate to islands on a ship.
When the ship reaches an island, the debug level scene appears.

Description

  • Add a map scene
  • Update the next scene navigation after main menu scene

Motivation and Context

How has this been tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@audreygentili audreygentili self-assigned this Feb 7, 2025
@audreygentili audreygentili linked an issue Feb 7, 2025 that may be closed by this pull request
project.godot Outdated Show resolved Hide resolved
project.godot Outdated Show resolved Hide resolved
resources/localization/MenuTranslations.en.translation Outdated Show resolved Hide resolved
scenes/map/Map.tscn Outdated Show resolved Hide resolved
Comment on lines 23 to 32
[node name="Island0Sprite" type="Sprite2D" parent="."]
unique_name_in_owner = true
position = Vector2(320, 220)

[node name="Clickable" parent="Island0Sprite" instance=ExtResource("1_3mm8m")]

[node name="Area2D" type="Area2D" parent="Island0Sprite/Clickable"]

[node name="CollisionShape2D" type="CollisionShape2D" parent="Island0Sprite/Clickable/Area2D"]
shape = SubResource("CircleShape2D_i4h8t")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As islands are the same, we might want to crate a custom node to reuse multiple times
image

scenes/map/map.gd Outdated Show resolved Hide resolved
Comment on lines 10 to 12
# Called when the node enters the scene tree for the first time.
func _ready():
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't need this method we can remove it.
However, did you think about how the map will behave if we open it between the 2nd and the 3rd island? How to draw the ship just above the 2nd island?

scenes/map/map.gd Outdated Show resolved Hide resolved
func _process(delta):
if (goal_island != null):
var island = _get_island(goal_island)
ship.position = ship.position.lerp(island.position, delta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may use move_toward to move an node if it's not a RigidBody2D

// with "ship_speed = 70" it looks nice
ship.position = ship.position.move_toward(island.position, delta * ship_speed)

@onready var island_1: Sprite2D = %Island1Sprite
@onready var island_2: Sprite2D = %Island2Sprite

var goal_island = null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having an id, we can keep a reference to the node instead, so we wouldn't need to get it every frame

@audreygentili audreygentili force-pushed the feat/create-interactive-map branch from e2a8215 to e2dde6b Compare February 10, 2025 08:05
@audreygentili audreygentili force-pushed the feat/create-interactive-map branch from e2dde6b to 9e390b6 Compare February 14, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

feat(map): create the interactive map scene
2 participants