From 7dbd759ce1546acedafbad23f668267615f2ee59 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Sun, 20 Aug 2023 04:30:55 -0600 Subject: add yourls usage --- live/blog/g/gogodot_jam3_devlog_1.html | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'live/blog/g/gogodot_jam3_devlog_1.html') diff --git a/live/blog/g/gogodot_jam3_devlog_1.html b/live/blog/g/gogodot_jam3_devlog_1.html index baf14d0..f73bb27 100644 --- a/live/blog/g/gogodot_jam3_devlog_1.html +++ b/live/blog/g/gogodot_jam3_devlog_1.html @@ -141,7 +141,7 @@

Other than that I used few key sprites from vryell: Controller & Keyboard Icons and a font from datagoblin: Monogram.

The snake

This is the most challenging part in my opinion as making all the body parts follow the head in a user defined path it’s kinda hard. I tried with like 4-5 options and the one I’m detailing here is the only one that worked as I wanted for me. This time the directory structure I’m using is the following:

-
+
FileSystem - Snake dir structure
FileSystem - Snake dir structure
@@ -175,7 +175,7 @@ func _rotate_to(direction: int) -> void: _direction = _direction.rotated(deg2rad(direction * Global.SNAKE_ROT_SPEED * get_physics_process_delta_time()))

After tunning all the necessary parameters you should get something like this:

-
+
Snake - Basic movement (left and right controls)
Snake - Basic movement (left and right controls)
@@ -212,7 +212,7 @@ func _on_Head_snake_path_new_point(coordinates: Vector2) -> void: update()

With this, we’re now populating the Path2D curve points with the position of the snake head. You should be able to see it because of the _draw call. If you run it you should see something like this:

-
+
Snake - Basic movement with path
Snake - Basic movement with path
@@ -256,7 +256,7 @@ func _on_Head_snake_path_new_point(coordinates: Vector2) -> void: _add_initial_segment(TAIL_SEGMENT_NP)

Select the Snake node and add the Body and Tail scene to the parameters, respectively. Then when running you should see something like this:

-
+
Snake - Basic movement with all body parts
Snake - Basic movement with all body parts
@@ -299,7 +299,7 @@ func _add_segment_to_queue() -> void: body_segment_queue.append(body_segment_queue.back() + Global.SNAKE_SEGMENT_SIZE)

With everything implemented and connected accordingly then we can add segments on demand (for testing I’m adding with a key press), it should look like this:

-
+
Snake - Basic movement with dynamic addition of new segments
Snake - Basic movement with dynamic addition of new segments
@@ -362,21 +362,21 @@ func _on_body_entered(body: Node) -> void: add_child(food)

And this is used in _process to place new food whenever needed. For now I added a condition to add food until 10 pieces are in place, and keep adding whenever the food is is lower than 10. After setting everything up, this is the result:

-
+
Snake - Food basic interaction
Snake - Food basic interaction

Za warudo! (The world)

It just happend that I saw a video to create random maps by using a method called random walks, this video was made by NAD LABS: Nuclear Throne Like Map Generation In Godot. It’s a pretty simple but powerful script, he provided the source code from which I based my random walker, just tweaked a few things and added others. Some of the maps than can be generated with this method (already aded some random sprites):

-
+
World map generator - Random map 1
World map generator - Random map 1
-
+
World map generator - Random map 2
World map generator - Random map 2
-
+
World map generator - Random map 3
World map generator - Random map 3
-- cgit v1.2.3-54-g00ecf