mirror of
https://github.com/mightypanders/GMTKJam2021.git
synced 2025-01-30 21:59:55 +01:00
Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
46b29ba4a4
@ -1,36 +1,7 @@
|
||||
class_name DropOffPoint
|
||||
extends Node2D
|
||||
|
||||
export var entity_name = "DROPOFF"
|
||||
export var destinationColor = Color.yellow
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
onready var sprite = $Sprite
|
||||
|
||||
|
||||
var colorList = [
|
||||
Color.yellow,
|
||||
Color.violet,
|
||||
Color.red,
|
||||
Color.turquoise,
|
||||
]
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
modulate_color()
|
||||
|
||||
func modulate_color():
|
||||
rng.randomize()
|
||||
var n = rng.randi_range(0,colorList.size()-1)
|
||||
print(n)
|
||||
destinationColor = colorList[n]
|
||||
print(destinationColor)
|
||||
sprite.modulate = destinationColor
|
||||
|
||||
|
||||
func _on_Timer_timeout():
|
||||
modulate_color()
|
||||
|
23
DropOffPoints.gd
Normal file
23
DropOffPoints.gd
Normal file
@ -0,0 +1,23 @@
|
||||
extends Node
|
||||
|
||||
var colorList = [
|
||||
Color.yellow,
|
||||
Color.violet,
|
||||
Color.red,
|
||||
Color.blue,
|
||||
]
|
||||
|
||||
onready var rng = RandomNumberGenerator.new()
|
||||
onready var dropOffChildern = get_children()
|
||||
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
|
||||
func random_color() -> Color:
|
||||
var n = rng.randi_range(0,colorList.size()-1)
|
||||
return colorList[n]
|
||||
|
||||
func set_colors():
|
||||
for dop in dropOffChildern:
|
||||
dop.destinationColor = random_color()
|
||||
dop.modulate_color()
|
64
Guest.gd
64
Guest.gd
@ -4,7 +4,7 @@ onready var pickUpArea = $PickUpArea
|
||||
onready var collision = $PhysicsCollision
|
||||
export var guestName = "Dieter"
|
||||
export var PICKUPTRESHOLD = 100
|
||||
export var destinationColor = Color.yellow
|
||||
export var destinationColor = Color.white
|
||||
var pickup_time
|
||||
|
||||
signal picked_up(color,name)
|
||||
@ -27,7 +27,7 @@ var colorList = [
|
||||
Color.yellow,
|
||||
Color.violet,
|
||||
Color.red,
|
||||
Color.turquoise
|
||||
Color.blue
|
||||
]
|
||||
var names = [
|
||||
'Dieter',
|
||||
@ -45,38 +45,38 @@ var follow_node = null
|
||||
var follow_guest = null
|
||||
var follow_pos = global_position
|
||||
|
||||
func set_state(state):
|
||||
if state == states.delivered:
|
||||
pickUpArea.monitorable = false
|
||||
pickUpArea.monitoring = false
|
||||
collision.disabled = true
|
||||
if state == states.waiting:
|
||||
collision.disabled = false
|
||||
mode = RigidBody2D.MODE_KINEMATIC
|
||||
if state == states.tethered:
|
||||
collision.disabled = false
|
||||
mode = RigidBody2D.MODE_STATIC
|
||||
|
||||
func _physics_process(delta):
|
||||
#linear_velocity = linear_velocity.clamped(100)
|
||||
|
||||
if currentState == states.waiting:
|
||||
linear_velocity.move_toward(Vector2.ZERO,5.0)
|
||||
collision.disabled = false
|
||||
|
||||
elif currentState == states.tethered:
|
||||
collision.disabled = true
|
||||
mode = RigidBody2D.MODE_STATIC
|
||||
var rot_dir = get_angle_to(follow_pos)
|
||||
|
||||
rotation += (rot_dir + deg2rad(90))*0.2
|
||||
var distance = follow_pos.distance_to(global_position)
|
||||
global_position = follow_pos
|
||||
pass
|
||||
elif currentState == states.delivered:
|
||||
pickUpArea.monitorable = false
|
||||
pickUpArea.monitoring = false
|
||||
collision.disabled = true
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if delivered != null and OS.get_system_time_msecs() - delivered > 1000:
|
||||
queue_free()
|
||||
|
||||
|
||||
if visible == false:
|
||||
follow_node = self
|
||||
if delivered == null:
|
||||
delivered = OS.get_system_time_msecs()
|
||||
currentState = states.delivered
|
||||
|
||||
if follow_node != null and follow_node != self:
|
||||
currentState = follow_node.currentState
|
||||
if follow_node.visible == false:
|
||||
@ -92,27 +92,22 @@ func _process(delta):
|
||||
|
||||
func _ready():
|
||||
rng.randomize()
|
||||
var spriteNum = rng.randi_range(0,100)
|
||||
if spriteNum % 2 == 0:
|
||||
$SpriteMarkus.visible = true
|
||||
sprite = $SpriteMarkus
|
||||
if spriteNum % 2 != 0:
|
||||
$SpriteSam.visible = true
|
||||
sprite = $SpriteSam
|
||||
var n = rng.randi_range(0,colorList.size()-1)
|
||||
destinationColor = colorList[n]
|
||||
sprite.modulate = destinationColor
|
||||
var m = rng.randi_range(0,names.size()-1)
|
||||
guestName = names[m]
|
||||
choose_random_sprite()
|
||||
assign_color()
|
||||
assign_name()
|
||||
|
||||
func assign_name():
|
||||
guestName = names[rng.randi_range(0,names.size()-1)]
|
||||
|
||||
func assign_color():
|
||||
destinationColor = colorList[rng.randi_range(0,colorList.size()-1)]
|
||||
sprite.modulate = destinationColor
|
||||
|
||||
func _on_PickUpArea_body_entered(body):
|
||||
print(body.name)
|
||||
if body.name == "Playa":
|
||||
pickup_time = OS.get_system_time_msecs()
|
||||
emit_signal("picked_up",destinationColor,guestName)
|
||||
# start pickup process
|
||||
# we are being picked up by the player
|
||||
pass
|
||||
|
||||
func _on_PickUpArea_area_entered(area):
|
||||
if area.name == "DROPOFF":
|
||||
@ -121,3 +116,12 @@ func _on_PickUpArea_area_entered(area):
|
||||
else:
|
||||
emit_signal("dropped_off_fail")
|
||||
|
||||
|
||||
func choose_random_sprite():
|
||||
var spriteNum = rng.randi_range(0,100)
|
||||
if spriteNum % 2 == 0:
|
||||
$SpriteMarkus.visible = true
|
||||
sprite = $SpriteMarkus
|
||||
if spriteNum % 2 != 0:
|
||||
$SpriteSam.visible = true
|
||||
sprite = $SpriteSam
|
@ -1,16 +0,0 @@
|
||||
extends Timer
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# 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
|
14
Playa.gd
14
Playa.gd
@ -109,10 +109,10 @@ func remove_Guests_from_Line(color):
|
||||
func _on_PickupCheckArea_area_entered(area):
|
||||
|
||||
if area.get_parent().is_in_group("DropOffPoint"):
|
||||
print("It's a DOP")
|
||||
#print("It's a DOP")
|
||||
var dop = area.get_parent()
|
||||
var color = dop.destinationColor
|
||||
print(color)
|
||||
#print(color)
|
||||
last_in_line = remove_Guests_from_Line(color)
|
||||
#drop all guests after first guest.color == DOP.color, also vanish all guests.color == DOP.color
|
||||
pass
|
||||
@ -124,10 +124,10 @@ func _on_PickupCheckArea_area_entered(area):
|
||||
#print("We already have you in line")
|
||||
pass
|
||||
else:
|
||||
print("Area has parent %s" % area.get_parent())
|
||||
print("It's a Guest")
|
||||
#print("Area has parent %s" % area.get_parent())
|
||||
#print("It's a Guest")
|
||||
last_in_line = add_Guest_to_Line(last_in_line,area.get_parent())
|
||||
print(last_in_line)
|
||||
#print(last_in_line)
|
||||
|
||||
print(guests)
|
||||
|
||||
@ -138,7 +138,7 @@ func _physics_process(delta):
|
||||
if g == null:
|
||||
guests.remove(g)
|
||||
var direction = Vector2.UP.rotated(rotation).normalized() #Playerrotation nehmen ist sicherer
|
||||
var forward_backward = Input.get_action_strength("ui_up") - Input.get_action_strength("ui_down")
|
||||
var forward_backward = Input.get_action_strength("accelerate") - Input.get_action_strength("brake")
|
||||
|
||||
|
||||
if forward_backward != 0:
|
||||
@ -146,7 +146,7 @@ func _physics_process(delta):
|
||||
else:
|
||||
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
|
||||
|
||||
var steer_dir = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
|
||||
var steer_dir = Input.get_action_strength("right") - Input.get_action_strength("left")
|
||||
|
||||
if steer_dir != 0 && velocity.length() > 0:
|
||||
var direction_new = direction.rotated(PI/1.5 * steer_dir * delta)
|
||||
|
7
World.gd
7
World.gd
@ -4,6 +4,7 @@ onready var streets = $Streets
|
||||
onready var used_cells = streets.get_used_cells()
|
||||
onready var guests = $Guests
|
||||
onready var money_label = $GUI/HBoxContainer/HBoxContainer2/Money
|
||||
onready var dropOffPointListNode = $DropOffPoints
|
||||
|
||||
export var player_score = 0
|
||||
|
||||
@ -17,15 +18,12 @@ const MAX_SPAWN_TRIES = 50
|
||||
onready var radius_guests = guests.get_child(0).exclusionZoneShape.shape.radius * 2
|
||||
export var max_guests = 10
|
||||
|
||||
func _on_Guest_picked_up(destinationColor,name):
|
||||
print('Picked Up %s with name %s' % [destinationColor,name])
|
||||
|
||||
func _process(delta):
|
||||
$GUI2/HBoxContainer/Time/Background/Number.text = String(int($GameTime.time_left))
|
||||
|
||||
func _ready():
|
||||
dropOffPointListNode.set_colors()
|
||||
rng.randomize()
|
||||
print(radius_guests)
|
||||
|
||||
func _physics_process(delta):
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
@ -65,7 +63,6 @@ func create_new_guest():
|
||||
|
||||
func _on_Playa_scored(value:int):
|
||||
spawn_tries = 0
|
||||
print('Its a score of %s'% String(value))
|
||||
player_score += value
|
||||
money_label.update_text(player_score)
|
||||
|
||||
|
35
World.tscn
35
World.tscn
@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=128 format=2]
|
||||
[gd_scene load_steps=129 format=2]
|
||||
|
||||
[ext_resource path="res://assets/city_tiles/Street.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/city_tiles/Buildings.png" type="Texture" id=2]
|
||||
@ -41,6 +41,7 @@
|
||||
[ext_resource path="res://assets/city_tiles/Tür 16 LU.png" type="Texture" id=39]
|
||||
[ext_resource path="res://assets/city_tiles/Fenster 16.png" type="Texture" id=40]
|
||||
[ext_resource path="res://GUIIngameBot.tscn" type="PackedScene" id=41]
|
||||
[ext_resource path="res://DropOffPoints.gd" type="Script" id=42]
|
||||
|
||||
[sub_resource type="ConvexPolygonShape2D" id=1]
|
||||
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
|
||||
@ -1440,26 +1441,29 @@ position = Vector2( 163.29, 78.3416 )
|
||||
rotation = 1.6223
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
|
||||
[node name="DropOffPoint" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 645.77, 99.6374 )
|
||||
[node name="DropOffPoints" type="Node" parent="."]
|
||||
script = ExtResource( 42 )
|
||||
|
||||
[node name="DropOffPoint2" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 520.662, 230.739 )
|
||||
[node name="DropOffPoint" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 598.689, 109.852 )
|
||||
|
||||
[node name="DropOffPoint3" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 166.312, 322.885 )
|
||||
[node name="DropOffPoint2" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 473.58, 240.953 )
|
||||
|
||||
[node name="DropOffPoint4" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 764.774, 506.833 )
|
||||
[node name="DropOffPoint3" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 119.23, 333.099 )
|
||||
|
||||
[node name="DropOffPoint5" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 953.763, 232.171 )
|
||||
[node name="DropOffPoint4" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 717.693, 517.047 )
|
||||
|
||||
[node name="DropOffPoint6" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 1207.01, 102.399 )
|
||||
[node name="DropOffPoint5" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 906.682, 242.385 )
|
||||
|
||||
[node name="DropOffPoint7" parent="." instance=ExtResource( 4 )]
|
||||
position = Vector2( 1156.61, 613.927 )
|
||||
[node name="DropOffPoint6" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 1159.93, 112.613 )
|
||||
|
||||
[node name="DropOffPoint7" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 1109.53, 624.141 )
|
||||
|
||||
[node name="GuestTimer" type="Timer" parent="."]
|
||||
wait_time = 1.019
|
||||
@ -1488,5 +1492,4 @@ margin_bottom = 712.354
|
||||
|
||||
[connection signal="scored" from="Playa" to="." method="_on_Playa_scored"]
|
||||
[connection signal="timeout" from="GuestTimer" to="." method="_on_GuestTimer_timeout"]
|
||||
[connection signal="picked_up" from="Guests/Guest" to="." method="_on_Guest_picked_up"]
|
||||
[connection signal="timeout" from="GameTime" to="." method="_on_GameTime_timeout"]
|
||||
|
@ -8,6 +8,16 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ {
|
||||
"base": "Node2D",
|
||||
"class": "DropOffPoint",
|
||||
"language": "GDScript",
|
||||
"path": "res://DropOffPoint.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"DropOffPoint": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="City Bound"
|
||||
@ -18,8 +28,44 @@ config/icon="res://icon.png"
|
||||
|
||||
window/size/width=1280
|
||||
window/size/height=720
|
||||
window/size/fullscreen=true
|
||||
window/stretch/mode="2d"
|
||||
|
||||
[input]
|
||||
|
||||
accelerate={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
brake={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
left={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
right={
|
||||
"deadzone": 0.5,
|
||||
"events": [ Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
Loading…
Reference in New Issue
Block a user