Created
November 17, 2021 06:33
-
-
Save WolfgangSenff/946b34d05cf07218f603196444abfddb to your computer and use it in GitHub Desktop.
For Jacob
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Area2D | |
const FlightMagnitude = 20.0 | |
const FlightFrequency = 5.0 | |
const FlightSpeed = 8.0 | |
var _current_flight_angle := 0.0 | |
var _flying_left := 1 | |
func _physics_process(delta : float) -> void: | |
_current_flight_angle += deg2rad(FlightFrequency) | |
global_position.y += FlightMagnitude * sin(_current_flight_angle) * delta | |
global_position.x -= FlightSpeed * delta * (_flying_left) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that in my template, I change _flying_left to be equal to 1 or -1 based on whether or not it has hit a wall.