|Topic was automatically imported from the old Question2Answer platform.
The game I’m trying to make involves the player having to control a rocket ship as it blasts off into space avoiding various projectiles.
I’d like to have it where the rocket rests at the bottom of the screen and you can only move it either left or right in order to avoid obstacles which will move down towards the player.
Right now I’m trying to create a beta version that has:
- A player sprite that can be moved left and right
- Randomly generated enemies that are either static or move from one side of the screen to the other
- The ability to die when coming into contact with an enemy
If you have any suggestions on how to approach any or all of these features I’d sincerely appreciate it. I also realize that this is kind of a vague overview so if you’d like me to get more specific on certain parts feel free to ask!
Thanks for your time!
Im new on godot but i will help you as much as I can:
Q:A player sprite that can be moved left and right
Input, just like this:
First Define The Move and speed it self
var motion = Vector2.ZERO
var speed = 20
and then use
if else statement for most basic ways
motion.x -= speed
motion.x += speed
if you want to make it more clean, you can use
motion.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
ui_right? check your Project->Project Setting->Input Map
and then start move
for more, you can read doc about it
Q: Randomly generated enemies that are either static or move from one side of the screen to the other
A: Implement Move above and give Random place to move and respawn using
rand(), you can learn rand from many documentation
Q:The ability to die when coming into contact with an enemy
A: First Create new Scene that had your kinematic2d and then add hurt box using Area2d on Enemy that you create before In Area2d inside Node tab, you can see
area_entered(area: Area2d) you can use that to your player, and be careful, always use Layer and Mask so the enemy know which one enemy and player
I’m sorry for my bad English, hope it help, you can ask me more on my email:
firstname.lastname@example.org, have a good day!