finish new maps
This commit is contained in:
parent
b0d7acdbba
commit
92cafad56a
12
Body2D.gd
12
Body2D.gd
@ -1,18 +1,7 @@
|
|||||||
extends RigidBody2D
|
extends RigidBody2D
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
|
||||||
pass # Replace with function body.
|
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
pass
|
|
||||||
|
|
||||||
func _integrate_forces(state: PhysicsDirectBodyState2D):
|
func _integrate_forces(state: PhysicsDirectBodyState2D):
|
||||||
var contact_count = state.get_contact_count()
|
var contact_count = state.get_contact_count()
|
||||||
#print("aa")
|
|
||||||
for i in range(contact_count):
|
for i in range(contact_count):
|
||||||
#print("bb")
|
#print("bb")
|
||||||
var collider_object = state.get_contact_collider_object(i)
|
var collider_object = state.get_contact_collider_object(i)
|
||||||
@ -27,6 +16,5 @@ func handle_player_collision(player: Player):
|
|||||||
$"..".drop()
|
$"..".drop()
|
||||||
player.drop()
|
player.drop()
|
||||||
|
|
||||||
|
|
||||||
func handle_pool_collision(pool: Pool):
|
func handle_pool_collision(pool: Pool):
|
||||||
$"..".exchange_with(pool)
|
$"..".exchange_with(pool)
|
||||||
|
@ -18,82 +18,42 @@ text = "Map Select"
|
|||||||
label_settings = SubResource("LabelSettings_kd1xo")
|
label_settings = SubResource("LabelSettings_kd1xo")
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="."]
|
[node name="Button" type="Button" parent="."]
|
||||||
offset_left = 24.0
|
offset_left = 26.0
|
||||||
offset_top = 261.0
|
offset_top = 165.0
|
||||||
offset_right = 199.0
|
offset_right = 201.0
|
||||||
offset_bottom = 324.0
|
offset_bottom = 228.0
|
||||||
text = "RGB"
|
|
||||||
script = ExtResource("2_ykkpr")
|
|
||||||
map_path = "res://maps/rgb.tscn"
|
|
||||||
|
|
||||||
[node name="Button2" type="Button" parent="."]
|
|
||||||
offset_left = 29.0
|
|
||||||
offset_top = 186.0
|
|
||||||
offset_right = 204.0
|
|
||||||
offset_bottom = 249.0
|
|
||||||
text = "Source"
|
|
||||||
script = ExtResource("2_ykkpr")
|
|
||||||
map_path = "res://maps/source.tscn"
|
|
||||||
|
|
||||||
[node name="Button3" type="Button" parent="."]
|
|
||||||
offset_left = 25.0
|
|
||||||
offset_top = 332.0
|
|
||||||
offset_right = 200.0
|
|
||||||
offset_bottom = 395.0
|
|
||||||
text = "CMY"
|
|
||||||
script = ExtResource("2_ykkpr")
|
|
||||||
map_path = "res://maps/cmy.tscn"
|
|
||||||
|
|
||||||
[node name="Button4" type="Button" parent="."]
|
|
||||||
offset_left = 397.0
|
|
||||||
offset_top = 188.0
|
|
||||||
offset_right = 572.0
|
|
||||||
offset_bottom = 251.0
|
|
||||||
text = "Rare"
|
text = "Rare"
|
||||||
script = ExtResource("2_ykkpr")
|
script = ExtResource("2_ykkpr")
|
||||||
map_path = "res://maps/rare.tscn"
|
map_path = "res://maps/rare.gd"
|
||||||
|
|
||||||
[node name="Button5" type="Button" parent="."]
|
[node name="Button2" type="Button" parent="."]
|
||||||
offset_left = 213.0
|
offset_left = 211.0
|
||||||
offset_top = 185.0
|
offset_top = 80.0
|
||||||
offset_right = 388.0
|
offset_right = 386.0
|
||||||
offset_bottom = 248.0
|
offset_bottom = 143.0
|
||||||
text = "Seperated"
|
text = "Large"
|
||||||
script = ExtResource("2_ykkpr")
|
script = ExtResource("2_ykkpr")
|
||||||
map_path = "res://maps/seperated.tscn"
|
map_path = "res://maps/large.gd"
|
||||||
|
|
||||||
[node name="Button6" type="Button" parent="."]
|
|
||||||
offset_left = 208.0
|
|
||||||
offset_top = 260.0
|
|
||||||
offset_right = 383.0
|
|
||||||
offset_bottom = 323.0
|
|
||||||
text = "RGB Sections"
|
|
||||||
script = ExtResource("2_ykkpr")
|
|
||||||
map_path = "res://maps/rgb_sections.tscn"
|
|
||||||
|
|
||||||
[node name="Button7" type="Button" parent="."]
|
[node name="Button7" type="Button" parent="."]
|
||||||
offset_left = 35.0
|
offset_left = 26.0
|
||||||
offset_top = 71.0
|
offset_top = 250.0
|
||||||
offset_right = 210.0
|
offset_right = 201.0
|
||||||
offset_bottom = 134.0
|
offset_bottom = 313.0
|
||||||
text = "Sections"
|
text = "Sections"
|
||||||
script = ExtResource("2_ykkpr")
|
script = ExtResource("2_ykkpr")
|
||||||
map_path = "res://maps/sections.gd"
|
map_path = "res://maps/sections.gd"
|
||||||
|
|
||||||
[node name="Button8" type="Button" parent="."]
|
[node name="Button8" type="Button" parent="."]
|
||||||
offset_left = 227.0
|
offset_left = 24.0
|
||||||
offset_top = 70.0
|
offset_top = 80.0
|
||||||
offset_right = 402.0
|
offset_right = 199.0
|
||||||
offset_bottom = 133.0
|
offset_bottom = 143.0
|
||||||
text = "Small"
|
text = "Small"
|
||||||
script = ExtResource("2_ykkpr")
|
script = ExtResource("2_ykkpr")
|
||||||
map_path = "res://maps/small.gd"
|
map_path = "res://maps/small.gd"
|
||||||
|
|
||||||
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]
|
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]
|
||||||
[connection signal="pressed" from="Button2" to="Button2" method="_on_pressed"]
|
[connection signal="pressed" from="Button2" to="Button2" method="_on_pressed"]
|
||||||
[connection signal="pressed" from="Button3" to="Button3" method="_on_pressed"]
|
|
||||||
[connection signal="pressed" from="Button4" to="Button4" method="_on_pressed"]
|
|
||||||
[connection signal="pressed" from="Button5" to="Button5" method="_on_pressed"]
|
|
||||||
[connection signal="pressed" from="Button6" to="Button6" method="_on_pressed"]
|
|
||||||
[connection signal="pressed" from="Button7" to="Button7" method="_on_pressed"]
|
[connection signal="pressed" from="Button7" to="Button7" method="_on_pressed"]
|
||||||
[connection signal="pressed" from="Button8" to="Button8" method="_on_pressed"]
|
[connection signal="pressed" from="Button8" to="Button8" method="_on_pressed"]
|
||||||
|
16
maps/large.gd
Normal file
16
maps/large.gd
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
var root
|
||||||
|
|
||||||
|
func create_map(_root):
|
||||||
|
root=_root
|
||||||
|
poolcircle(Vector2(0,0),2000,100,1000,1000,1000)
|
||||||
|
|
||||||
|
func poolcircle(pos: Vector2, radius, count, r,g,b):
|
||||||
|
for n in range(1,count+1):
|
||||||
|
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
||||||
|
var t=(float(n)/count)*3.141*2
|
||||||
|
new_pool.position = pos + (Vector2(sin(t),cos(t))*radius)
|
||||||
|
new_pool.mana_r=r
|
||||||
|
new_pool.mana_g=g
|
||||||
|
new_pool.mana_b=b
|
||||||
|
new_pool.get_node("StaticBody2D/CollisionShape2D2").disabled=true;
|
||||||
|
root.call_deferred("add_child",new_pool)
|
18
maps/rare.gd
Normal file
18
maps/rare.gd
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
var root
|
||||||
|
|
||||||
|
func create_map(_root):
|
||||||
|
self.root=_root
|
||||||
|
poolcircle(Vector2(0,0),0,1,10,0,0)
|
||||||
|
|
||||||
|
poolcircle(Vector2(0,0),2000,100,0,5000,0)
|
||||||
|
|
||||||
|
func poolcircle(pos: Vector2, radius, count, r,g,b):
|
||||||
|
for n in range(1,count+1):
|
||||||
|
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
||||||
|
var t=(float(n)/count)*3.141*2
|
||||||
|
new_pool.position = pos + (Vector2(sin(t),cos(t))*radius)
|
||||||
|
new_pool.mana_r=r
|
||||||
|
new_pool.mana_g=g
|
||||||
|
new_pool.mana_b=b
|
||||||
|
new_pool.get_node("StaticBody2D/CollisionShape2D2").disabled=true;
|
||||||
|
root.call_deferred("add_child",new_pool)
|
@ -2,7 +2,6 @@ var root
|
|||||||
|
|
||||||
func create_map(root):
|
func create_map(root):
|
||||||
self.root=root
|
self.root=root
|
||||||
pass # Replace with function body.
|
|
||||||
poolcircle(Vector2(0,0),200,32,100,0,0)
|
poolcircle(Vector2(0,0),200,32,100,0,0)
|
||||||
poolcircle(Vector2(600,0),200,32,0,100,0)
|
poolcircle(Vector2(600,0),200,32,0,100,0)
|
||||||
poolcircle(Vector2(1200,0),200,32,0,0,100)
|
poolcircle(Vector2(1200,0),200,32,0,0,100)
|
||||||
@ -13,15 +12,11 @@ func create_map(root):
|
|||||||
|
|
||||||
poolcircle(Vector2(600,200),2000,100,1000,1000,1000)
|
poolcircle(Vector2(600,200),2000,100,1000,1000,1000)
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(delta):
|
|
||||||
pass
|
|
||||||
|
|
||||||
func poolcircle(pos: Vector2, radius, count, r,g,b):
|
func poolcircle(pos: Vector2, radius, count, r,g,b):
|
||||||
for n in range(1,count+1):
|
for n in range(1,count+1):
|
||||||
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
||||||
var t=(float(n)/count)*3.141*2
|
var t=(float(n)/count)*3.141*2
|
||||||
print(t)
|
|
||||||
new_pool.position = pos + (Vector2(sin(t),cos(t))*radius)
|
new_pool.position = pos + (Vector2(sin(t),cos(t))*radius)
|
||||||
new_pool.mana_r=r
|
new_pool.mana_r=r
|
||||||
new_pool.mana_g=g
|
new_pool.mana_g=g
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
var root
|
var root
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func create_map(_root):
|
func create_map(_root):
|
||||||
root=_root
|
root=_root
|
||||||
poolcircle(Vector2(0,0),2000,100,1000,1000,1000)
|
poolcircle(Vector2(0,0),200,16,100,100,100)
|
||||||
|
|
||||||
func poolcircle(pos: Vector2, radius, count, r,g,b):
|
func poolcircle(pos: Vector2, radius, count, r,g,b):
|
||||||
for n in range(1,count+1):
|
for n in range(1,count+1):
|
||||||
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
var new_pool: Pool = load("res://pool.tscn").instantiate()
|
||||||
var t=(float(n)/count)*3.141*2
|
var t=(float(n)/count)*3.141*2
|
||||||
print(t)
|
|
||||||
new_pool.position = pos + (Vector2(sin(t),cos(t))*radius)
|
new_pool.position = pos + (Vector2(sin(t),cos(t))*radius)
|
||||||
new_pool.mana_r=r
|
new_pool.mana_r=r
|
||||||
new_pool.mana_g=g
|
new_pool.mana_g=g
|
||||||
|
33
sim.gd
33
sim.gd
@ -4,42 +4,11 @@ var spawn_position=Vector2(100,100);
|
|||||||
|
|
||||||
# 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():
|
func _ready():
|
||||||
#setup_edge_collisions()
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func setup_edge_collisions():
|
|
||||||
var screen_size = get_viewport_rect().size
|
|
||||||
|
|
||||||
# Create a StaticBody2D for each edge
|
|
||||||
for i in range(4):
|
|
||||||
var body = StaticBody2D.new()
|
|
||||||
body.collision_layer=4 #walls
|
|
||||||
add_child(body)
|
|
||||||
|
|
||||||
var shape = CollisionShape2D.new()
|
|
||||||
body.add_child(shape)
|
|
||||||
|
|
||||||
var rect_shape = RectangleShape2D.new()
|
|
||||||
shape.shape = rect_shape
|
|
||||||
|
|
||||||
# Adjust size and position based on the edge
|
|
||||||
match i:
|
|
||||||
0: # Top
|
|
||||||
rect_shape.extents = Vector2(screen_size.x / 2, 10)
|
|
||||||
body.position = Vector2(screen_size.x / 2, 0)
|
|
||||||
1: # Bottom
|
|
||||||
rect_shape.extents = Vector2(screen_size.x / 2, 10)
|
|
||||||
body.position = Vector2(screen_size.x / 2, screen_size.y)
|
|
||||||
2: # Left
|
|
||||||
rect_shape.extents = Vector2(10, screen_size.y / 2)
|
|
||||||
body.position = Vector2(0, screen_size.y / 2)
|
|
||||||
3: # Right
|
|
||||||
rect_shape.extents = Vector2(10, screen_size.y / 2)
|
|
||||||
body.position = Vector2(screen_size.x, screen_size.y / 2)
|
|
||||||
|
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event.is_action_pressed("escape"):
|
if event.is_action_pressed("escape"):
|
||||||
get_tree().change_scene_to_file("res://map_select.tscn")
|
get_tree().change_scene_to_file("res://map_select/map_select.tscn")
|
||||||
get_node("/root/Sim").queue_free()
|
get_node("/root/Sim").queue_free()
|
||||||
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
spawn_position=get_global_mouse_position()
|
spawn_position=get_global_mouse_position()
|
||||||
|
Loading…
Reference in New Issue
Block a user