This commit is contained in:
user 2024-12-31 05:20:12 +01:00
parent 9b7bace36d
commit 4e50fedb50
4 changed files with 10 additions and 9 deletions

View File

@ -11,5 +11,7 @@ func _unhandled_input(event: InputEvent) -> void:
if event.is_pressed():
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
self.fov -= 1 * (5 if Input.is_key_pressed(KEY_SHIFT) else 1)
self.size -= 1 * (0.2 if Input.is_key_pressed(KEY_SHIFT) else 0.05)
if event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
self.fov += 1 * (5 if Input.is_key_pressed(KEY_SHIFT) else 1)
self.size += 1 * (0.2 if Input.is_key_pressed(KEY_SHIFT) else 0.05)

View File

@ -3,12 +3,11 @@ extends Node
var CURRENT_LEVEL: Node3D = null
var CURRENT_PLAYER: CharacterBody3D = null
var combined_signal : Observable
var prop = ReactiveProperty.new(42)
signal TestSignal
func _ready() -> void:
var lvl: Resource = load("res://assets/levels/level1.tscn")
var lvl: Resource = load("res://assets/levels/maps/debug1.tscn")
var player: Resource = load("res://assets/characters/player.tscn")
CURRENT_LEVEL = lvl.instantiate()
CURRENT_PLAYER = player.instantiate()
@ -16,16 +15,14 @@ func _ready() -> void:
add_child(CURRENT_LEVEL)
CURRENT_LEVEL.add_child(CURRENT_PLAYER)
combined_signal = GDRx.from_signal(Messagebus.CHANGE_SCENE)\
.first()\
.debounce(1)
.debounce(0.2)
combined_signal.subscribe(transition_to).dispose_with(self)
#prop.subscribe(func(i): print(">> ", i))
func transition_to(scene: PackedScene):
func transition_to(scene: String):
print(">>>>>>>"+str(scene))
CURRENT_LEVEL.remove_child(CURRENT_PLAYER)
remove_child(CURRENT_LEVEL)
var lvl = load(scene.resource_path)
var lvl = load("res://assets/levels/maps/"+scene+".tscn")
var new_level = lvl.instantiate()
new_level.add_child(CURRENT_PLAYER)
CURRENT_PLAYER.transform.origin = Vector3(0, 1, 0)

View File

@ -1,3 +1,5 @@
extends Node
signal CHANGE_SCENE(scene)
signal CHANGE_SCENE(scene: String)
signal DEBUG_XYZ(origin: Vector3)
signal DEBUG_MAP(name: String)

View File

@ -3,7 +3,7 @@ extends MeshInstance3D
func _ready():
if material_override != null:
material_override.albedo_texture = $SubViewport.get_texture()
material_override.albedo_texture = $SubViewport.get_texture()
#func _process(delta):
#self.look_at(camera.global_position, Vector3.UP, true)