#Grim Grind Devlogs

7 messages · Page 1 of 1 (latest)

old iris
#
extends CharacterBody2D

const TARGET_FPS = 60
const MAX_SPEED = 100
const ACCEL = 12
const JUMP_VELOCITY = -250
const FRIC = 10

@onready var animationPlayer = $AnimationPlayer 
@onready var sprite = $AnimatedSprite2D

# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var jumpsLeft = 2

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

    if is_on_floor() or is_on_wall():
        jumpsLeft = 2

    # Handle Jump.
    if Input.is_action_just_pressed("ui_accept") and jumpsLeft > 0:
        jumpsLeft -= 1
        animationPlayer.play("Jump")
    
        if is_on_wall_only():
            velocity = Vector2(-JUMP_VELOCITY/2, JUMP_VELOCITY)
            if not sprite.flip_h:
                velocity.x = -velocity.x
        else:
            velocity.y = JUMP_VELOCITY

    # Get the input direction and handle the movement/deceleration.
    # As good practice, you should replace UI actions with custom gameplay actions.
    var direction = Input.get_axis("ui_left", "ui_right")
    if direction:
        velocity.x += direction * ACCEL * delta * TARGET_FPS
        velocity.x = clamp(velocity.x, -MAX_SPEED, +MAX_SPEED)
        
        animationPlayer.play("Run")
        sprite.flip_h = direction<0
    else:
        velocity.x = move_toward(velocity.x, 0, FRIC * delta * TARGET_FPS)
        animationPlayer.play("Idle")

    move_and_slide()
old iris
#

Eren's Platformer Devlogs

#

added;
+wall slide
+interactable objects
+scene changes (basic level system)
+climbable ladders and vines

planned on adding;
-puzzle elements like boxes and pressure pads and buttons
-fully seamless level system,
-sfx and vfx
-keys and doors

old iris
#

game name: Grim Grind

#

Grim Grind Devlogs