hello! this is a personal log to document my growth on learning..... GDscript!!
Recently, i've been keeping myself busy by trying to learn GDscript. I've always loved video games, so i decided why not try to create my own?
i've always dabbled with coding a bit. i've created a few quizes in c#, i used to go crazy on scratch when i was a kid, designed this spacehey profile, and i messed around with lua in roblox a bit, too. but, nothing ever serious. i always got turned off by how much you have to learn before you make anything cool.
BUT NOT TODAY!!!! i will make my totally cool and awesome game, even if im struggling to make the player character move up and down right now! yeah... currently, i've copied down some code from a tutorial, but i can only make the player move on the x-axis, and for some reason, i can only move left and right while pressing the up key.
this is the pain in my ass:
extends Area2D
@export var speed = 400
var screen_size
func _ready():
screen_size = get_viewport_rect().size
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed("move_right"):
velocity.x = 100
if Input.is_action_pressed("move_left"):
velocity.x = -100
if Input.is_action_pressed("move_down"):
velocity.y = 100
if Input.is_action_pressed("move_up"):
velocity.y = -100
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
i have a rough idea on what most of these functions and variables do, but i still can't figure it out!!!
im probably just going to scrap this script and write one from scratch with my own two hands!! i've gotten so far as to learn what the heck variables do and how to write functions. so.. good progress?
i think im gonna use my spring break to grind out finishing all the lessons on GDquest.io
silent hill 3 poster bcuz i thought it was cool
Comments
Displaying 0 of 0 comments ( View all | Add Comment )