1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-29 03:04:17 +00:00
pineapple-surf/player/onhand/BaseWeapon.gd

39 lines
706 B
GDScript3
Raw Normal View History

extends Node
class_name BaseWeapon
enum WeaponSlot {
ONE,
TWO,
THREE
}
2023-01-08 01:25:48 +00:00
enum AmmoType {
NONE,
SINGLE
}
@export_range(0,1) var MOUSE_MOVEMENT_BOB_AMOUNT := 0.5
var player: Player
var weaponSlot: WeaponSlot = WeaponSlot.ONE
2023-01-08 01:25:48 +00:00
var ammoType: AmmoType = AmmoType.NONE
var mouse_movement := Vector2.ZERO
func on_switch_in():
pass
func on_switch_out():
pass
func bob_weapon(node: Node3D, delta: float):
node.position = Vector3.ZERO.lerp(Vector3(
0,
self.mouse_movement.x*0.05,
-self.mouse_movement.y*0.05,
), delta / MOUSE_MOVEMENT_BOB_AMOUNT)
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
var vec = event.relative
self.mouse_movement = Vector2(vec.y, vec.x)