George
George

Reputation: 93

How do i make a kinematicbody2d flap in godot? (c#)

I am creating a flappy bird like game, to learn more about game development, i realized that jumping to complex project ideas isnt a good idea. So i abandoned them, and started to create. Not much has passed and i already didnt know what to do, and that is to make my kinematic body flap like in flappy bird.

i wrote this code:

using Godot;
using System;
public class Bird : KinematicBody2D
{
    public override void _Ready()
    {
    }
    public override void _Process(float delta)
    {
        if (Input.IsActionPressed("ui_up"))
        {
            this.Position += new Vector2(0, -20);
        }
        else 
        {
            this.Position += new Vector2(0, 20);
        }
    }
}

but this doesnt make the body flap, it just raises it up if an action is pressed and down if nothing else is happening

Upvotes: 0

Views: 71

Answers (0)

Related Questions