summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Spatial.gd23
-rw-r--r--Spatial.tscn2
-rw-r--r--box.gd3
-rw-r--r--floor.pngbin100924 -> 384800 bytes
-rw-r--r--jail.tscn75
-rw-r--r--powerup.gd18
-rw-r--r--powerup.tscn2
-rw-r--r--zombie.gd12
8 files changed, 66 insertions, 69 deletions
diff --git a/Spatial.gd b/Spatial.gd
index 7d5fb7b..b98b01e 100644
--- a/Spatial.gd
+++ b/Spatial.gd
@@ -4,6 +4,7 @@ const t = preload("res://team.gd")
var b = preload("res://box.tscn")
var z = preload("res://zombie.tscn")
var pwup = preload("res://powerup.tscn")
+var pw = preload("res://powerup.gd")
var blue_points = 0
var pink_points = 0
@@ -11,6 +12,8 @@ var jailpos: Vector3
var zombies = []
var boxes = []
+signal new_points
+
func set_points(box, points):
var team = box.myteam
@@ -19,9 +22,8 @@ func set_points(box, points):
else:
pink_points += points
- $CanvasLayer/blue.text = "Team Blue: %d" % blue_points
- $CanvasLayer/pink.text = "Team Pink: %d" % pink_points
- jailpos -= Vector3(0, points * 0.25, 0)
+ on_points()
+ jailpos -= Vector3(0, points * 0.5, 0)
func _entered(box):
set_points(box, 1)
@@ -29,6 +31,10 @@ func _entered(box):
func _exited(box):
set_points(box, -1)
+func on_points():
+ $CanvasLayer/blue.text = "Team Blue: %d" % blue_points
+ $CanvasLayer/pink.text = "Team Pink: %d" % pink_points
+
func _physics_process(delta):
var jail = get_node("jail")
var pos = jail.global_transform.origin
@@ -75,6 +81,16 @@ func create_box(team):
add_child(box)
func _on_powerup(node):
+ if node.get_type() == pw.Type.swap:
+ var blue = blue_points
+
+ for b in boxes:
+ b.set_team(b.get_team() ^ 1)
+
+ blue_points = pink_points
+ pink_points = blue
+ emit_signal("new_points")
+
remove_child(node)
func create_zombie(id, team, pos):
@@ -117,3 +133,4 @@ func _ready():
$powerup_timer.connect("timeout", self, "_on_powerup_timeout")
$powerup_timer.start(randi() % 31 + 1)
+ connect("new_points", self, "on_points")
diff --git a/Spatial.tscn b/Spatial.tscn
index 9a7d672..6a748d5 100644
--- a/Spatial.tscn
+++ b/Spatial.tscn
@@ -123,7 +123,7 @@ light_energy = 0.3
shadow_enabled = true
[node name="jail" parent="." instance=ExtResource( 3 )]
-transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 4.62, 0 )
+transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 15.315, 0 )
collision_layer = 4
collision_mask = 4
diff --git a/box.gd b/box.gd
index 905a463..7045224 100644
--- a/box.gd
+++ b/box.gd
@@ -7,6 +7,9 @@ signal exited
var myteam = t.Team.BLUE
var _floor: Node
+func get_team():
+ return myteam
+
func set_team(team):
var mesh = get_node("MeshInstance")
var material = mesh.get_active_material(0).duplicate()
diff --git a/floor.png b/floor.png
index be739ac..55de752 100644
--- a/floor.png
+++ b/floor.png
Binary files differ
diff --git a/jail.tscn b/jail.tscn
index bb95cac..8b060d7 100644
--- a/jail.tscn
+++ b/jail.tscn
@@ -1,9 +1,16 @@
-[gd_scene load_steps=3 format=2]
+[gd_scene load_steps=5 format=2]
-[sub_resource type="CylinderMesh" id=1]
+[ext_resource path="res://Jaula_gato_naro.png" type="Texture" id=1]
-[sub_resource type="CylinderShape" id=2]
-height = 1.8
+[sub_resource type="PlaneMesh" id=1]
+size = Vector2( 2, 12 )
+
+[sub_resource type="SpatialMaterial" id=2]
+flags_transparent = true
+albedo_texture = ExtResource( 1 )
+
+[sub_resource type="BoxShape" id=3]
+extents = Vector3( 0.1, 10.75, 2 )
[node name="RigidBody" type="RigidBody"]
mode = 1
@@ -12,61 +19,11 @@ gravity_scale = 0.0
[node name="Spatial" type="Spatial" parent="."]
transform = Transform( 2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0 )
-[node name="base" type="MeshInstance" parent="Spatial"]
-transform = Transform( 0.5, 0, 0, 0, 0.0241527, 0, 0, 0, 0.5, 0, 0, 0 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../..")
-
-[node name="cyl" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, 0, 18.6455, 0.892701 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="cyl2" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, 0, 18.646, -0.893 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="cyl3" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, -0.893, 18.646, 0 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="cyl4" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, 0.893, 18.646, 0 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="cyl5" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, -0.606322, 18.646, 0.592541 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="cyl6" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, 0.606, 18.646, 0.593 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="cyl7" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, 0.606, 18.646, -0.593 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="cyl8" type="MeshInstance" parent="Spatial/base"]
-transform = Transform( 0.0750184, 0, 0, 0, 17.704, 0, 0, 0, 0.0750184, -0.606, 18.646, -0.593 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../../..")
-
-[node name="top" type="MeshInstance" parent="Spatial"]
-transform = Transform( 0.5, 0, 0, 0, 0.0241527, 0, 0, 0, 0.5, 0.03, 0.9, 0 )
-mesh = SubResource( 1 )
-skeleton = NodePath("../..")
-
-[node name="top2" type="MeshInstance" parent="Spatial"]
-transform = Transform( -0.02, 0, 0, 0, 4.56437, 0, 0, 0, -0.02, 0.03, 5.47471, 0 )
+[node name="MeshInstance" type="MeshInstance" parent="Spatial"]
+transform = Transform( 1.31134e-07, -1, 3.82137e-15, 4.37114e-08, 1.91069e-15, -1, 1, 1.31134e-07, 4.37114e-08, 0, 0, 0 )
mesh = SubResource( 1 )
-skeleton = NodePath("../..")
+material/0 = SubResource( 2 )
[node name="CollisionShape" type="CollisionShape" parent="."]
-transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.915008, 0 )
-shape = SubResource( 2 )
+transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.665382, 0 )
+shape = SubResource( 3 )
diff --git a/powerup.gd b/powerup.gd
index a5cab6e..fa8b038 100644
--- a/powerup.gd
+++ b/powerup.gd
@@ -4,6 +4,8 @@ enum Type {
none
magnet
explosion
+ superspeed
+ swap
max_pw
}
@@ -13,7 +15,21 @@ var mytype
func get_type():
return mytype
+func _ready():
+ var color = Color(0, 0, 0, 0)
+
+ match mytype:
+ Type.magnet:
+ color = Color(0, 0.8, 0.8, 1.0)
+ Type.explosion:
+ color = Color(0.8, 0, 0, 1.0)
+ Type.superspeed:
+ color = Color(0, 0.8, 0, 1.0)
+ Type.swap:
+ color = Color(0.8, 0.8, 0.8, 1.0)
+
+ $light.light_color = color
+
func _init():
mytype = randi() % (Type.max_pw - 1) + 1
- print("type=%d" % mytype)
add_to_group("powerup")
diff --git a/powerup.tscn b/powerup.tscn
index 87846aa..89ee20e 100644
--- a/powerup.tscn
+++ b/powerup.tscn
@@ -22,7 +22,7 @@ mesh = SubResource( 1 )
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.456184, 0 )
shape = SubResource( 2 )
-[node name="OmniLight" type="OmniLight" parent="."]
+[node name="light" type="OmniLight" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0 )
light_color = Color( 0, 0.537255, 0.560784, 1 )
light_energy = 7.388
diff --git a/zombie.gd b/zombie.gd
index c6de7a3..026386f 100644
--- a/zombie.gd
+++ b/zombie.gd
@@ -42,23 +42,27 @@ func _physics_process(delta):
var rightleft = ((Input.get_action_strength(id + "right")
- Input.get_action_strength(id + "left")) * 2 * delta)
var curdir = Dir.none
+ var vspeed = 2
+
+ if powerup == pw.Type.superspeed:
+ vspeed = 8
if rightleft:
if rightleft > 0:
- speed.x = 2
+ speed.x = vspeed
curdir = Dir.right
else:
- speed.x = -2
+ speed.x = -vspeed
curdir = Dir.left
else:
speed.x = lerp(speed.x, 0, delta * zspeed)
if updown:
if updown > 0:
- speed.z = 2
+ speed.z = vspeed
curdir = Dir.up
else:
- speed.z = -2
+ speed.z = -vspeed
curdir = Dir.down
else:
speed.z = lerp(speed.z, 0, delta * zspeed)