diff --git a/src/DynamicMap.gd b/src/DynamicMap.gd index e1452fc..23551fb 100644 --- a/src/DynamicMap.gd +++ b/src/DynamicMap.gd @@ -5,12 +5,14 @@ func _ready() -> void: #B3D.Load("GFX\\npcs\\106_2.b3d") add_child(B3D.Load("GFX\\apache.b3d")) + DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) + #RMesh.LoadRMesh(self, roomInfo["mesh path"]) #CreateMap() IntroEnabled = true - #LoadRoomTemplates("Data\\rooms.ini") - #CreateMap() + LoadRoomTemplates("Data\\rooms.ini") + CreateMap() var IntroEnabled: bool var I_Zone: MapZones = MapZones.new() diff --git a/src/Player.gd b/src/Player.gd index fecbe89..a77b8c5 100644 --- a/src/Player.gd +++ b/src/Player.gd @@ -80,8 +80,17 @@ var MenuOpen = false const WHITE = Color(1, 1, 1) const IRRITATED_RED = Color(0.78431372549, 0, 0) +var cameraMoveByVector = Vector2() + func _process(delta: float) -> void: - + if (abs(cameraMoveByVector.x) > 0 or abs(cameraMoveByVector.y) > 0): + Rotation.x -= rad_to_deg(cameraMoveByVector.x * 120 * delta); + Rotation.y -= rad_to_deg(cameraMoveByVector.y * 120 * delta); + if Rotation.x > 70: + Rotation.x = 70 + if Rotation.x < -70: + Rotation.x = -70 + if Playable: if Input.is_action_just_pressed("player_blink"): BlinkTimer = 0 @@ -437,6 +446,7 @@ func snapDownToFloorCheck(): wasOnFloorLastFrame = is_on_floor() snappedLastFrame = didSnap +const CONTROLLER_DEADZONE = 0.20; func _input(event: InputEvent) -> void: if event is InputEventMouseMotion: Rotation.y -= event.relative.x / 2 @@ -446,3 +456,15 @@ func _input(event: InputEvent) -> void: if Rotation.x < -70: Rotation.x = -70 #event.velocity + if event is InputEventJoypadMotion: + # LeftRight = 2, UpDown = 3 + if event.axis == 2: + if abs(event.axis_value) < CONTROLLER_DEADZONE: + cameraMoveByVector.y = 0; + else: + cameraMoveByVector.y = event.axis_value / 45; + elif event.axis == 3: + if abs(event.axis_value) < CONTROLLER_DEADZONE: + cameraMoveByVector.x = 0; + else: + cameraMoveByVector.x = event.axis_value / 45;