9 hours ago, sprotz said:
This is more like it, except for auto collisions.
It looks like you didn't understand the code you where using in Blitz3D I will explain it so that you can see Godot is exactly the same:
If Keydown(up_key) Then MoveEntity Object 0,1,0
If Keydown is your input. You use this to tell what input to check. The MoveEntity Object is the target this gode has to move and 0,1,0 and this last part is your vector.
Godot works exactly the same:
if Input.is_action_pressed("ui_up"): move_and_slide (Vector3(0,1,0))
if Input.is_action_pressed("ui_up") this is you input check. move_and_slide() by default move and slide will execute on the target object. Last is the vector Vector3(0,1,0) Godot uses long names that clearly define what each thing does, to make it easy as you don't have to remember abbreviations.
So the simplest movement in Blitz3D looks like this:
If Keydown(up_key) = true Then MoveEntity Object 0,1,0
If Keydown(down_key) = true Then MoveEntity Object 0,-1,0
If Keydown(right_key) = true Then MoveEntity Object 1,0,0
If Keydown(left_key) = true Then MoveEntity Object -1,0,0
The simplest Godot version is like this:
if Input.is_action_pressed("ui_up"):
move_and_slide (Vector3(0,1,0))
if Input.is_action_pressed("ui_down"):
move_and_slide (Vector3(0,-1,0))
if Input.is_action_pressed("ui_right"):
move_and_slide (Vector3(1,0,0))
if Input.is_action_pressed("ui_left"):
move_and_slide (Vector3(-1,0,0))
The nice thing about Godot is that you can visually see what part is the IF part and what part is the Execute part.
Both these methods are considered bad practice when working with games. Because code runs from the top line to the lower line. Meaning that if you move like this and pressed both the up and down key, the object will always move down.
So to fix this the Godot tutorial uses math, to provide better input like this:
#The vector is made above all the other code, so that the other code can change it
var velocity = Vector3(0,0,0)
if Input.is_action_pressed("ui_up"):
velocity.y += 1 #this now makes velocity Vector3(0,1,0)
if Input.is_action_pressed("ui_down"):
velocity.y += -1 #this now makes velocity Vector3(0,-1,0)
if Input.is_action_pressed("ui_right"):
velocity.x += 1 #this now makes velocity Vector3(1,0,0)
if Input.is_action_pressed("ui_left"):
velocity.x += -1 #this now makes velocity Vector3(-1,0,0)
velocity = move_and_slide(velocity) #this now calculates the smooth movment using the combined
So the reason Godot teaches it like this, is that velocity increases or decreases as you hold the button. The += means Velocity.x = Velocity.x+1 in other words it's own value plus one. If you used just = then it would be 1 and this would mean that down would cancel up, instead of slowing down.
Of course you could have done the same thing in Blitz3D, to get more realistic input.
9 hours ago, sprotz said:
Exactly. Even Unity's code is shorter and simpler than that, and a number of other game engines' code.
No, Unity doesn't have simple collisions. You would have needed to grab the rigidbody component and add force to it. Or if you really wanted the simple collision style you would have to emulate it using rays, here is a 2D example: https://answers.unity.com/questions/972878/simple-top-down-2d-collision.html
Godot is much closer to Blitz3D than Unity.
It looks like you are having a hard time because you don't know programming. I recommend you do a few python tutorials. Python is easy and is very-very similar to GDScript.