Logo

dev-resources.site

for different kinds of informations.

Game Development Diary #4 : First Course Complete

Published at
5/24/2024
Categories
godot
godotengine
gamedev
newbie
Author
hizrawandwioka
Categories
4 categories in total
godot
open
godotengine
open
gamedev
open
newbie
open
Author
14 person written this
hizrawandwioka
open
Game Development Diary #4 : First Course Complete

24/05/2024 - Friday

Today Progress :

-Continue Collision Detection

Detect RigidBody collisions with signals and identify bodies with Groups

first connect signal to method by clicking this menu

Image description

func _on_body_entered(body: Node) -> void:
    if body.name == "LandingPad":
        print('you touch landingpad!')

Enter fullscreen mode Exit fullscreen mode

use this code to detect if the character touch the destination or not

and add detection if user touch the floor then the user lose using the code below

func _on_body_entered(body: Node) -> void:
    if "Goal" in body.get_groups():
        print('you touch landingpad!')
    if "LoseCondition" in body.get_groups():
        print('You Lose!')

Enter fullscreen mode Exit fullscreen mode

-The Export Annotation

Replace ‘magic numbers’ with variables and control them from the inspector.

export a variable so it can be used in the inspector pane

## How much vertical force to when user move the character
@export_range(750.0,3000.0 ) var thrust: float = 1000.0
## How much force to when user move the character
@export_range(50.0,250.0 ) var torque: float = 100.0
Enter fullscreen mode Exit fullscreen mode

and it will show in the inspector toolbar

Image description

-Crashing and Respawning

Use functions and get_tree() to respawn when crashing.

func _on_body_entered(body: Node) -> void:
    if "Goal" in body.get_groups():
        complete_level()
    if "LoseCondition" in body.get_groups():
        crash()

func complete_level():
    print('you touch landingpad!')
    get_tree().quit()

func crash():
    print('JEDER BOOM DUAR!!')
    get_tree().reload_current_scene()
Enter fullscreen mode Exit fullscreen mode

i create two function that called when user touch floor or landing page. and i called get_tree function to reload the current scene or quit the game.

-Loading the Next Level

Making two new levels and using the landing pads to load them.

  1. First i create the other level scene
  2. On the previous level landing page, create script to select thescene destination
extends CSGBox3D

@export_file("*.tscn") var file_path

Enter fullscreen mode Exit fullscreen mode

on the toolbar, select the next level file path

Image description

and we can continue to next level if we landed in the launching pad.

-Learning Tweens

Use tweens to sequence and delay function calls.


func complete_level(next_level: String) -> void:
    print('you touch landingpad!')
    set_process(false)
    is_transitioning = true
    var tween = create_tween()
    tween.tween_interval(1.0)
    tween.tween_callback(
        get_tree().change_scene_to_file.bind(next_level)
        )


func crash():
    print('JEDER BOOM DUAR!!')
    set_process(false)
    is_transitioning = true
    var tween = create_tween()
    tween.tween_interval(1.0)
    tween.tween_callback(get_tree().reload_current_scene)

Enter fullscreen mode Exit fullscreen mode

add tween to delay the function. so it give 1 second delay after the character touch the landing page or crash.

-Tweening Hazards

Use the AnimatableBody3D node and Tweens to create moving obstacles for the player to dodge.

so the code will lookike this :

@export var destination:Vector3
@export var duration: float = 1.0

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
    var tween = create_tween()
    tween.tween_property(self, "global_position", global_position+destination, duration)

Enter fullscreen mode Exit fullscreen mode

-Learning Audio

Use the AudioStreamPlayer node to play one off sound effects when the player crashes and completes levels.

-Controlling Audio With Scripts

Use the AudioStreamPlayer 3D and else statements to play sounds when the player is boosting.

-Learning Particles

Learning how to use the GPUParticles3D node and control its emitting property for the character boosters.

-One Shot Particles

Learn how to use one shot particles for an explosion and to show the player has reached the goal.

-change the character with complex shape / model

Use the MeshInstance3D node and a variety of shapes to customize your player rocket

-Coloring the character

Saving and reusing the StandardMaterial3D node to color in the player ship.

-Building Backgrounds

Learning to use Constructive Solid Geometry to build walls and background objects for our levels.

-Lighting the Scene

Improving the WorldEnvironment DirectionalLight3D and adding Omnilights to improve the levels appearance.

-Exporting Game

Learn how to create files players can run by downloading templates and exporting the project.

Resources :

Complete Godot 3D: Code Your Own 3D Games In Godot 4! - GameDevTv Courses

Next Step :

I will implement all knowledge I gain from this course to start developing my game!!

To Do List :

*Create a level, just simple plane with some obstacles(just basic shapes).
*Implement collision detection to the level.
*Create 3 Main Character according to the novel(Just use capsule first until I get the 3d model that suitable for the game - because I am not good at art, but I will try to create by myself first.)
*Use Input Mapper to create a button that can switch the playable character.

*After I complete all item in the To Do List, I will continue the courses.

godotengine Article's
30 articles in total
Favicon
Game Dev Diary #1: Starting from zero
Favicon
Online Visual Novel in Godot: Case Study on Sentou Gakuen
Favicon
How to Press and Drag to Reposition a Window in Godot
Favicon
"Surf the Rails in Subway Surfers Online"
Favicon
AR Game ~ Geospatial API Sample ~
Favicon
Navigating the Skies: A Comprehensive Analysis of the Aircraft Engine MRO Market
Favicon
Going from Godot 3 to 4 (The Easy Way)
Favicon
Godot 2D & 3D Prototype Templates
Favicon
Perfecting Game Levels: The Essential Role of Playtesting
Favicon
Reading data from Mysql server
Favicon
Game Development Diary #11 : Second Day Back
Favicon
Game Development Diary #8 : Still Second Course
Favicon
Game Development Diary #7 : Second Course
Favicon
Game Development Diary #5 : Start My "BUMI" Project - Part 1
Favicon
Game Development Diary #4 : First Course Complete
Favicon
10 Useful Tips for Getting the Most Out of Godot
Favicon
Why Godot is a Game Changer in Game Development
Favicon
Game Development Diary #2 : GameDev.tv Course
Favicon
Estruturas de repetição em GDScript
Favicon
Estruturas condicionais em GDScript
Favicon
Boas Práticas nomeando variáveis e funções em GDScript
Favicon
Kingdom Hearts RE:Back Cover
Favicon
Godot Engine
Favicon
Hash SHA1 at go
Favicon
Let’s Learn Godot 3D by making an Endless Runner Game - Part 1: Project Overview & Setup 👟
Favicon
Let’s Learn Godot 3D by making an Endless Runner Game — Part 2: Environment Setup👟
Favicon
Let’s Learn Godot 3D by making an Endless Runner Game — Part 3: Player Setup & Animations👟
Favicon
Every beginning is hard or my first steps with GODOT - The 1st month
Favicon
BlackJack - Beta version
Favicon
Disney Gargoyles native porting Development Update 🚀

Featured ones: