Hi BadWisp,
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
A: using 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
if Input.is_action_pressed('ui_left'):
motion.x -= speed
elif Input.is_action_pressed('ui_right):
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")
what is ui_left
and ui_right
? check your Project->Project Setting->Input Map
and then start move
move_and_slide(motion)
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:
[email protected], have a good day!