meow
This commit is contained in:
parent
1dadffeac4
commit
ab1797b9ed
6 changed files with 120 additions and 61 deletions
71
2dWorld.tscn
71
2dWorld.tscn
|
|
@ -1,17 +1,17 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://biu528mgexdyp"]
|
[gd_scene load_steps=6 format=3 uid="uid://biu528mgexdyp"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://cdw1vlidvg2yt" path="res://Sprites/Cyclone.png" id="1_1wkcu"]
|
|
||||||
[ext_resource type="Texture2D" uid="uid://b48ofysofsffi" path="res://icon.svg" id="1_2uw02"]
|
[ext_resource type="Texture2D" uid="uid://b48ofysofsffi" path="res://icon.svg" id="1_2uw02"]
|
||||||
[ext_resource type="Script" uid="uid://u353j4q7l26d" path="res://cyclone.gd" id="1_xr6w1"]
|
[ext_resource type="Script" uid="uid://bdc53dgnhonif" path="res://worldManager.gd" id="1_gy87s"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://vv75ycmtipn7" path="res://Prefabs/cyclone.tscn" id="3_u230a"]
|
||||||
[ext_resource type="Script" uid="uid://b1w10iwwhm5bj" path="res://addons/Fantail-Interactive.top_down_camera/td_camera_2d.gd" id="4_u230a"]
|
[ext_resource type="Script" uid="uid://b1w10iwwhm5bj" path="res://addons/Fantail-Interactive.top_down_camera/td_camera_2d.gd" id="4_u230a"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_xr6w1"]
|
|
||||||
radius = 32.0
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xr6w1"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xr6w1"]
|
||||||
size = Vector2(674, 28)
|
size = Vector2(674, 28)
|
||||||
|
|
||||||
[node name="2dWorld" type="Node2D"]
|
[node name="2dWorld" type="Node2D" node_paths=PackedStringArray("camera", "map")]
|
||||||
|
script = ExtResource("1_gy87s")
|
||||||
|
camera = NodePath("TDCamera2D")
|
||||||
|
map = NodePath("WorldMap")
|
||||||
|
|
||||||
[node name="WorldMap" type="Sprite2D" parent="."]
|
[node name="WorldMap" type="Sprite2D" parent="."]
|
||||||
modulate = Color(1.8049e-07, 0.391665, 0.150329, 1)
|
modulate = Color(1.8049e-07, 0.391665, 0.150329, 1)
|
||||||
|
|
@ -19,56 +19,16 @@ position = Vector2(589, 319)
|
||||||
scale = Vector2(5, 5)
|
scale = Vector2(5, 5)
|
||||||
texture = ExtResource("1_2uw02")
|
texture = ExtResource("1_2uw02")
|
||||||
|
|
||||||
[node name="Cyclone" type="RigidBody2D" parent="." node_paths=PackedStringArray("sprite", "label", "wind_speed_label", "line")]
|
[node name="Cyclones" type="Node2D" parent="."]
|
||||||
position = Vector2(572, 229)
|
|
||||||
gravity_scale = 0.0
|
|
||||||
lock_rotation = true
|
|
||||||
script = ExtResource("1_xr6w1")
|
|
||||||
sprite = NodePath("Sprite2D")
|
|
||||||
label = NodePath("cLabel")
|
|
||||||
wind_speed_label = NodePath("wsLabel")
|
|
||||||
line = NodePath("Line2D")
|
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="Cyclone"]
|
[node name="Cyclone" parent="Cyclones" instance=ExtResource("3_u230a")]
|
||||||
scale = Vector2(0.2, 0.2)
|
position = Vector2(514, 230)
|
||||||
texture = ExtResource("1_1wkcu")
|
|
||||||
|
|
||||||
[node name="Line2D" type="Line2D" parent="Cyclone"]
|
[node name="Cyclone2" parent="Cyclones" instance=ExtResource("3_u230a")]
|
||||||
position = Vector2(-572, -229)
|
position = Vector2(746, 473)
|
||||||
width = 2.0
|
|
||||||
default_color = Color(0.656747, 0, 0.0830602, 1)
|
|
||||||
joint_mode = 2
|
|
||||||
|
|
||||||
[node name="cLabel" type="Label" parent="Cyclone"]
|
[node name="Cyclone3" parent="Cyclones" instance=ExtResource("3_u230a")]
|
||||||
offset_left = -21.0
|
position = Vector2(463, 494)
|
||||||
offset_top = -11.0
|
|
||||||
offset_right = 19.0
|
|
||||||
offset_bottom = 12.0
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
text = "1"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
vertical_alignment = 1
|
|
||||||
|
|
||||||
[node name="wsLabel" type="Label" parent="Cyclone"]
|
|
||||||
offset_left = -21.0
|
|
||||||
offset_top = -66.0
|
|
||||||
offset_right = 19.0
|
|
||||||
offset_bottom = -43.0
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
text = "1"
|
|
||||||
horizontal_alignment = 1
|
|
||||||
vertical_alignment = 1
|
|
||||||
|
|
||||||
[node name="changeTimer" type="Timer" parent="Cyclone"]
|
|
||||||
wait_time = 5.0
|
|
||||||
autostart = true
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Cyclone"]
|
|
||||||
shape = SubResource("CircleShape2D_xr6w1")
|
|
||||||
|
|
||||||
[node name="newPointTimer" type="Timer" parent="Cyclone"]
|
|
||||||
wait_time = 0.5
|
|
||||||
autostart = true
|
|
||||||
|
|
||||||
[node name="Background" type="CanvasLayer" parent="."]
|
[node name="Background" type="CanvasLayer" parent="."]
|
||||||
layer = -1
|
layer = -1
|
||||||
|
|
@ -103,6 +63,3 @@ shape = SubResource("RectangleShape2D_xr6w1")
|
||||||
position = Vector2(579, 330)
|
position = Vector2(579, 330)
|
||||||
script = ExtResource("4_u230a")
|
script = ExtResource("4_u230a")
|
||||||
metadata/_custom_type_script = "uid://b1w10iwwhm5bj"
|
metadata/_custom_type_script = "uid://b1w10iwwhm5bj"
|
||||||
|
|
||||||
[connection signal="timeout" from="Cyclone/changeTimer" to="Cyclone" method="_on_timer_timeout"]
|
|
||||||
[connection signal="timeout" from="Cyclone/newPointTimer" to="Cyclone" method="_on_new_point_timer_timeout"]
|
|
||||||
|
|
|
||||||
60
Prefabs/cyclone.tscn
Normal file
60
Prefabs/cyclone.tscn
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://vv75ycmtipn7"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://u353j4q7l26d" path="res://cyclone.gd" id="1_khbba"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://cdw1vlidvg2yt" path="res://Sprites/Cyclone.png" id="2_7e2hf"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_xr6w1"]
|
||||||
|
radius = 32.0
|
||||||
|
|
||||||
|
[node name="Cyclone" type="RigidBody2D" node_paths=PackedStringArray("sprite", "label", "wind_speed_label", "line")]
|
||||||
|
gravity_scale = 0.0
|
||||||
|
lock_rotation = true
|
||||||
|
script = ExtResource("1_khbba")
|
||||||
|
sprite = NodePath("Sprite2D")
|
||||||
|
label = NodePath("cLabel")
|
||||||
|
wind_speed_label = NodePath("wsLabel")
|
||||||
|
line = NodePath("Line2D")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
scale = Vector2(0.2, 0.2)
|
||||||
|
texture = ExtResource("2_7e2hf")
|
||||||
|
|
||||||
|
[node name="Line2D" type="Line2D" parent="."]
|
||||||
|
position = Vector2(-572, -229)
|
||||||
|
width = 2.0
|
||||||
|
default_color = Color(0.656747, 0, 0.0830602, 1)
|
||||||
|
joint_mode = 2
|
||||||
|
|
||||||
|
[node name="cLabel" type="Label" parent="."]
|
||||||
|
offset_left = -21.0
|
||||||
|
offset_top = -11.0
|
||||||
|
offset_right = 19.0
|
||||||
|
offset_bottom = 12.0
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "1"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="wsLabel" type="Label" parent="."]
|
||||||
|
offset_left = -21.0
|
||||||
|
offset_top = -66.0
|
||||||
|
offset_right = 19.0
|
||||||
|
offset_bottom = -43.0
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "1"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="changeTimer" type="Timer" parent="."]
|
||||||
|
wait_time = 5.0
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_xr6w1")
|
||||||
|
|
||||||
|
[node name="newPointTimer" type="Timer" parent="."]
|
||||||
|
wait_time = 0.5
|
||||||
|
autostart = true
|
||||||
|
|
||||||
|
[connection signal="timeout" from="changeTimer" to="." method="_on_timer_timeout"]
|
||||||
|
[connection signal="timeout" from="newPointTimer" to="." method="_on_new_point_timer_timeout"]
|
||||||
12
cyclone.gd
12
cyclone.gd
|
|
@ -5,10 +5,10 @@ extends RigidBody2D
|
||||||
@export var label : Label
|
@export var label : Label
|
||||||
@export var wind_speed_label : Label
|
@export var wind_speed_label : Label
|
||||||
@export var line : Line2D
|
@export var line : Line2D
|
||||||
var wind_speed : float = 30
|
var wind_speed : float = 0.1
|
||||||
#var move_speed : float = 20
|
#var move_speed : float = 20
|
||||||
var wind_acceleration : float = 0.2
|
var wind_acceleration : float = 5
|
||||||
var wind_change : float = 0.2
|
var wind_change : float = 5
|
||||||
var wind_penalty : float = 0
|
var wind_penalty : float = 0
|
||||||
var sprite_spin : float = 40
|
var sprite_spin : float = 40
|
||||||
|
|
||||||
|
|
@ -16,16 +16,19 @@ var move_acceleration : Vector2 = Vector2(0,0)
|
||||||
var move_change : Vector2 = Vector2(0,0)
|
var move_change : Vector2 = Vector2(0,0)
|
||||||
var velocity : Vector2 = Vector2(0,0)
|
var velocity : Vector2 = Vector2(0,0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
label.text = get_category()
|
label.text = get_category()
|
||||||
sprite.self_modulate = Color(1,1,1, clamp(wind_speed/20,0,1) )
|
sprite.self_modulate = Color(1,1,1, clamp(wind_speed/20,0,1) )
|
||||||
wind_speed_label.text = str(round(wind_speed*10)/10)
|
wind_speed_label.text = str(round(wind_speed*10)/10) + "km/h"
|
||||||
sprite.rotation_degrees += sprite_spin * delta
|
sprite.rotation_degrees += sprite_spin * delta
|
||||||
if wind_speed <= 0:
|
if wind_speed <= 0:
|
||||||
end_cyclone()
|
end_cyclone()
|
||||||
|
|
@ -81,6 +84,7 @@ func get_category() -> String:
|
||||||
return "TD"
|
return "TD"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_timer_timeout() -> void:
|
func _on_timer_timeout() -> void:
|
||||||
do_something()
|
do_something()
|
||||||
|
|
||||||
|
|
|
||||||
6
readme.md
Normal file
6
readme.md
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Todo
|
||||||
|
- [ ] Make cyclones loop around edges
|
||||||
|
- [ ] simulation speed control
|
||||||
|
- [ ] create cyclones by picking a point on the map
|
||||||
|
- [ ] load custom images
|
||||||
|
- [ ] recalculate bounds based on custom images
|
||||||
31
worldManager.gd
Normal file
31
worldManager.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var camera : Camera2D
|
||||||
|
@export var map : Sprite2D
|
||||||
|
@export var cyclones : Array[RigidBody2D]
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
check_edges()
|
||||||
|
|
||||||
|
func check_edges():
|
||||||
|
#var right_center = map.global_position + Vector2(map.texture.get_width(), 0)
|
||||||
|
#var top_center = map.global_position + Vector2(0, map.texture.get_height())
|
||||||
|
var map_top : float = map.global_position.y + map.texture.get_height()
|
||||||
|
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))
|
||||||
|
|
||||||
|
for cyclone in cyclones:
|
||||||
|
pass
|
||||||
|
|
||||||
|
pass
|
||||||
1
worldManager.gd.uid
Normal file
1
worldManager.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bdc53dgnhonif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue