0 votes

Hello,
I am programming a fun game, for me and my friends. Its nothing special. Its a Platformer like Mario. In my secound world I wanted to add ranged enemies, but I can't manage to do it. I searched everywhere in the internet, but didn't find something. And the videos I found, I didn't understand it. So can I may ask you for a tutorial how to do this? It would be really nice and would help me out. Hopefully someone answers me :)

Godot version 3.0
in Engine by (14 points)

1 Answer

0 votes

More clear with the question, is it the shooting behaviour, the "shoot kan kill player" behaviour or what?

I think the best example would be shooter game tutorial , but apply the player logic for shooting enemies from the video to the enemies instead.

the basic flow that I can think of:

create a bullet scene (for instancing) contain area2D or RigidBody2D depends on your need, with logic of moving in 1 direction

enemy scene -> create a timer signal -> on_timeout , instance a bullet in front of the enemy sprite -> if the bullet collision with player / player body entered the bullet, run damaging the player function

don't forget to queue_free the bullet so it doesn't make the game lag

by (16 points)
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.