...
This commit is contained in:
parent
685bee6e6a
commit
94e7cb04b0
4 changed files with 65 additions and 17 deletions
|
|
@ -0,0 +1,16 @@
|
|||
Sprite2D node
|
||||
|
||||
F => focus view on object
|
||||
|
||||
To get type information in code auto-completion, go to _Editor -> Editor Settings_, and in the _Text Editor -> Completion_ section, turn on the checkbox named _Add Type Hints_. You can also search for "type hints" in the search bar at the top of the window to find it quickly.
|
||||
|
||||
|
||||
`Vector2` values have a function named `angle()` that calculates and returns the vector's angle in radians. If we assign that to the ship's rotation, it will turn to face its move direction.
|
||||
|
||||
```gdscript
|
||||
var velocity = Vector2(480, -480)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
position += velocity * delta
|
||||
rotation = velocity.angle()
|
||||
````
|
||||
Loading…
Add table
Add a link
Reference in a new issue