-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
scenes/map/Map.tscn
Outdated
[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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scenes/map/map.gd
Outdated
# Called when the node enters the scene tree for the first time. | ||
func _ready(): | ||
pass |
There was a problem hiding this comment.
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
func _process(delta): | ||
if (goal_island != null): | ||
var island = _get_island(goal_island) | ||
ship.position = ship.position.lerp(island.position, delta) |
There was a problem hiding this comment.
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)
scenes/map/map.gd
Outdated
@onready var island_1: Sprite2D = %Island1Sprite | ||
@onready var island_2: Sprite2D = %Island2Sprite | ||
|
||
var goal_island = null |
There was a problem hiding this comment.
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
e2a8215
to
e2dde6b
Compare
e2dde6b
to
9e390b6
Compare
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
Motivation and Context
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist: