I'm new to Godot and I'm so frustrated because I simply can't find a concrete answer to this question. I've been searching and experimenting for days and this issue will not clear. Furthermore, those answering the question for themselves or others give vague details, information specific to a different style of game, pose solutions from older versions that don't work on the current version, or pose solutions for a totally different language. I'm attending a pre-made online course, my instructor hasn't responded to my question, and I'm practicing by building this game as I learn.
I really hope someone can help me with this. Here's some background. I'm making a brick breaker game; paddle hits ball, ball hits brick, brick breaks, rinse and repeat. The good ol' fashioned casual game that many love to burn time with. Maybe it's just my OCD and this doesn't really matter in the long run, but I'm afraid this might become a bug that causes performance issues or overuses resources. I want a clean game that doesn't require a lot of resource usage.
I'm sure I've already overdone it while trying to fix this one issue because my test works exactly the same way without much of the code I've added, at the advice of others, to address this. Nothing has been effective and I only got two errors on top of the issue I already have.
Line 11 (UNUSEDVARIABLE):The local variable 'xinput' is declared but never used in the block. If this is intended, prefix it with an underscore: 'xinput'(ignore) [I don't want to ignore this because I haven't decided whether or not I'll be using this variable later]
Line 15 (RETURNVALUEDISCARDED):The function 'moveandcollide()' returns a value, but this value is never used. [I don't know what to do with this value]
const TARGET_FPS = 60
const SPEED = 60
var motion = Vector2.ZERO
onready var sprite = $Sprite # Grants access to the Hammer sprite.
var xinput = Input.getactionstrength("uiright") and Input.getactionstrength("ui_left")
motion.y = 0 # Character is unaffected by gravity.
move_and_collide(motion, Vector2.LEFT and Vector2.RIGHT) # Tells the program there has been a Wall collision.
motion.x = SPEED
motion.y = 0
motion.x = -SPEED
motion.y = 0
motion.x = 0
motion.y = 0
Needless to say, I get a wall of:
It's printing this for every frame when I run it and I'd like it to stop and just wait for player input before printing again. I've watched countless videos of other programmers who don't have this problem, none address it, and copying parts of their code to test hasn't helped. I'm using version 3.2. Someone please rescue me. I need to know what I'm doing wrong and how to fix it.