#first time using godot

26 messages · Page 1 of 1 (latest)

serene ingot
#

hello its my first time using godot and id like to share this with you

video attached is the basic conept of the game
ill add pixel art when i can, and add score
and make new platforms
have a nice time looking at my code when i publish it xD

#

real proud of my self for this one


func spawn_platform():
    var platform = test_platform_scene.instantiate()
    
    var platform_spawn_location = Vector2(
        randi_range(-16,x_maximum), 
        Player.position.y + randi_range(y_minimum, y_minimum+320))
    platform.position = platform_spawn_location
    add_child(platform)
    
    platform.exit_camera.connect(self.on_exiting_camera_view)
  

it spawns the platform bellow the player that the player can get to it

the camera follows the player but ill delete that, its a debug feature xD

vernal oriole
#

Looks pretty cool!

serene ingot
#

tnx man working on the assets now

#

not sure how to make a hamster ball soo the curse smiley xD

vernal oriole
serene ingot
#

yeeeep

#

best app i ever got

vernal oriole
#

better not exclaim it from the rooftops 🤭

serene ingot
#

no where in the rules i cant say

vernal oriole
#

who of us is without sin lol

serene ingot
#

me

#

look at this little qtpie

vernal oriole
vernal oriole
# serene ingot look at this little qtpie

Also if u wanna give it hamster ball effect I feel like u could just make the ball be the controlled-by-the-player thingy and give the lil' guy inside it a separate sprite, then give him some physics.

#

I am, however, stupid and have zero experience with the engine besides some doc reading and whatnot.

serene ingot
vernal oriole
serene ingot
#

heres the code

#
extends CharacterBody2D


const SPEED = 300.0
const JUMP_VELOCITY = -300.0

@export var rotation_speed = 7 

var was_on_floor = true

var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")


func _physics_process(delta):
    if not is_on_floor():
        velocity.y += gravity * delta

    if Input.is_action_just_pressed("up") and was_on_floor:
        velocity.y = JUMP_VELOCITY
        was_on_floor = false
    
    if is_on_floor():
        was_on_floor = true

    var direction = Input.get_axis("left", "right")
    if direction:
        velocity.x = direction * SPEED
    else:
        velocity.x = move_toward(velocity.x, 0, SPEED)
    
    if direction > 0.5:
        rotation += rotation_speed * delta
    elif direction < -0.5:
        rotation -= rotation_speed * delta

    move_and_slide()```
#

YEAH BABY

serene ingot
#

wohooo i finaly have this working
used this to do it

@onready var platform_scene_array: Array = [
preload("res://scene's/Platform_1.tscn"), 
preload("res://scene's/Platform_2.tscn"), 
preload("res://scene's/Platform_3.tscn")]


func spawn_platform():
    var platform = platform_scene_array[randi_range(0, platform_scene_array.size() -1)].instantiate()
    
    platform_spawn_location_func()
    
    platform.position = platform_spawn_location
    add_child(platform)


func platform_spawn_location_func():
    platform_spawn_location = Vector2(
        randi_range(16,x_maximum), 
        y_minimum)
serene ingot