This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I want to make the same bullet mechanic as in this video
but without rotating the player. I need bullets to just head towards the mouse cursor, just like in Enter the gungeon. How do I make it?

I just changed the engine from GMS2 to Godot, so sorry for the stupid question.

Godot version 3.3.2
in Engine by (12 points)

your question isnt stupid but very vague! You do not present us any code or show us any specific proplem you have with your code.

1 Answer

+1 vote
#player shoot code
func _ready():
    var bullet = preload("bullet path").instance()
    bullet.global_position = $muzzle.global_postiton

#this is for the bullet
func _process(delta):
    position -= global_transform.x*speed
    #towords its local x axis
by (467 points)

It says "Invalid call. Nonexistent function 'setastoplevel' in base 'PackedScene'."

var bullet = preload("res://bullet.tscn").instance()
bullet.global_position = global_position

did you include.instance()this makes the scene an actual object

Yes, i forgot to .instance() it.
The game now doesn't crash, but it works.. well.. really weird.

Player code
Bullet code

var bullet = preload("res://bullet.tscn").instance()
        bullet.global_position = position

it has to be in this order otherwise and for the bullet position += transform.x*speed

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.