How do i make an object move without animation player or player input

Godot Version

4.2

Question

I’m making a bullet hell shmup and i’m following a Godot 3 tutorial, and I’m trying to make the bullets move, but whenever I try to make the bullets move in a direction, it gives me this error message:
Error setting property ‘position’ with value of type int.
So i’m flabbergasted on how to fix this :confused: I am NOT an experienced dev, so any feedback would help

It sounds like you are trying to set or add to position which is a Vector2 meaning it has a x and y component, but you are only adding a number, so Godot has no idea which component you wish to add to

use position.x if you mean to move left/right and position.y if you wish to move up/down.

some objects may want to move “forward” relative to how they are rotated, in that case you will need to add to both components with a little bit of vector math. Godot provides transform.x as a forward vector, so this sample will move forward at 5 pixels per frame

position += transform.x * 5

it fixed one problem, but now nothings moving ;-; now, on another script file, it’s saying THIS:
Invalid assignment of property or key ‘position’ with value of type ‘float’ on a base object of type ‘Area2D (bullet.gd)’.
i have NO idea what it means, so :confused:

Oh, and here are the scripts.
enemy.gd


bullet.gd

Your bullet.gd script is of type Character2D, but you’re getting an error message about your bullet being Area2D. This makes me think that your bullet.tscn file is of type Area2D. There are other problems, but that may be one of them.

Can you post the entire error message that includes line numbers?

Samer error actually; self.rotation is a single number, in radians. It’s unlikely you mean to assign position to the radian value of your rotation, you probably ment to use b.rotation = self.rotation

Your bullet probably doesn’t move because you add to the x position only once, when the bullet is spawned, you would need another script on your bullet with a _process function to run every frame.

extends Node2D

func _process(delta: float) -> void:
    # moves forward at 200 pixels per second
    position += transform.x * 200 * delta

It might be a good idea to get familiar with GDScript


Make sure to paste scripts instead of screen shots

tysm to the both of you!!! it works flawlessly!!! and thanks for the reccommendations for learning!