meow
This commit is contained in:
parent
ab1797b9ed
commit
d5455ef493
7 changed files with 239 additions and 53 deletions
|
|
@ -2,7 +2,11 @@ extends Node2D
|
|||
|
||||
@export var camera : Camera2D
|
||||
@export var map : Sprite2D
|
||||
@export var cyclones : Array[RigidBody2D]
|
||||
@export var cyclone_holder : Node2D
|
||||
|
||||
@export var speed_slider : HSlider
|
||||
@export var speed_label : Label
|
||||
@export var file_picker : FileDialog
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
|
@ -11,7 +15,9 @@ func _ready() -> void:
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
check_edges()
|
||||
#check_edges()
|
||||
update_zoom()
|
||||
update_ui()
|
||||
|
||||
func check_edges():
|
||||
#var right_center = map.global_position + Vector2(map.texture.get_width(), 0)
|
||||
|
|
@ -20,12 +26,51 @@ func check_edges():
|
|||
var map_bottom : float = map.global_position.y - map.texture.get_height()
|
||||
var map_right : float = map.global_position.x + map.texture.get_width()
|
||||
var map_left : float = map.global_position.x - map.texture.get_width()
|
||||
print("Top: " + str(map_top))
|
||||
print("Bottom: " + str(map_top))
|
||||
print("Left: " + str(map_top))
|
||||
print("Right: " + str(map_top))
|
||||
#print("Top: " + str(map_top))
|
||||
#print("Bottom: " + str(map_top))
|
||||
#print("Left: " + str(map_top))
|
||||
#print("Right: " + str(map_top))
|
||||
|
||||
for cyclone in cyclones:
|
||||
pass
|
||||
#for cyclone in cyclones:
|
||||
#pass
|
||||
|
||||
pass
|
||||
|
||||
func update_zoom():
|
||||
#print(1/camera.zoom.x)
|
||||
var scale_level : float = clampf(1/camera.zoom.x,0,1)
|
||||
for cyclone in cyclone_holder.get_children():
|
||||
cyclone.visuals.scale = Vector2(scale_level,scale_level)
|
||||
|
||||
func update_ui():
|
||||
var selected_speed : float = speed_slider.value
|
||||
var actual_speed : float
|
||||
# 3=1.0x, 2=0.5x, 1=0.25x, 0=0.0x, 4=2x 5=3x 6=4x
|
||||
match int(selected_speed):
|
||||
0:
|
||||
actual_speed = 0.0001
|
||||
1:
|
||||
actual_speed = 0.25
|
||||
2:
|
||||
actual_speed = 0.5
|
||||
3:
|
||||
actual_speed = 1
|
||||
4:
|
||||
actual_speed = 2
|
||||
5:
|
||||
actual_speed = 4
|
||||
6:
|
||||
actual_speed = 8
|
||||
speed_label.text = "Speed: " + str(round(actual_speed*100)/100) + "x"
|
||||
Engine.time_scale = actual_speed
|
||||
|
||||
|
||||
|
||||
func _on_load_image_pressed() -> void:
|
||||
file_picker.show()
|
||||
|
||||
|
||||
func _on_file_dialog_file_selected(path: String) -> void:
|
||||
var new_image : Image = Image.load_from_file(path)
|
||||
var image_texture : ImageTexture = ImageTexture.create_from_image(new_image)
|
||||
map.texture = image_texture
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue