![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | DragoXing |
I am watching a GDQuest tutorial from Oct 2, 2019. Not sure what version this is…
https://www.youtube.com/watch?v=Mc13Z2gboEk&list=PL-mK09n3GWSVzWd3UwAtts8Wi11WgOsJB&index=19 #1:18:34
Using stable version 4 and GDScript, most of these issues I have been able to sort out myself by rather omitting code or googling answers, however here I’m at a loss…
The script I’m stuck on is extended from the Actor.gd that has only
extends CharacterBody2D
class_name Actor
@export var speed: Vector2 = Vector2(300.0, 1000.0)
@export var gravity: float = 3000.0
My problem is in the enemy script, the goal is to make sure it has gravity.
Error at (7, 5) Invalid operands “Vector2” and “float” for assignment operator
extends "res://src/Actors/Actor.gd"
func _ready() -> void:
velocity.x = -speed.x
func _physics_process(delta: float) -> void:
velocity += gravity * delta
if is_on_wall():
velocity.x *= -1.0
move_and_slide()
This is my first time asking a question I hope the format is acceptable!