mirror of
https://github.com/mightypanders/GMTKJam2021.git
synced 2025-01-30 21:59:55 +01:00
Merge pull request #6 from mightypanders/various_qol_tweaks
Various qol tweaks
This commit is contained in:
commit
625873ab74
@ -1,37 +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()
|
43
Guest.gd
43
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',
|
||||
@ -58,11 +58,9 @@ func set_state(state):
|
||||
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:
|
||||
var rot_dir = get_angle_to(follow_pos)
|
||||
rotation += (rot_dir + deg2rad(90))*0.2
|
||||
@ -79,7 +77,6 @@ func _process(delta):
|
||||
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:
|
||||
@ -95,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":
|
||||
@ -124,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
|
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)
|
||||
|
||||
|
27
World.tscn
27
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,27 +1441,28 @@ position = Vector2( 163.29, 78.3416 )
|
||||
rotation = 1.6223
|
||||
scale = Vector2( 0.5, 0.5 )
|
||||
|
||||
[node name="DropOffPointList" type="Node" parent="."]
|
||||
[node name="DropOffPoints" type="Node" parent="."]
|
||||
script = ExtResource( 42 )
|
||||
|
||||
[node name="DropOffPoint" parent="DropOffPointList" instance=ExtResource( 4 )]
|
||||
position = Vector2( 614.148, 114.608 )
|
||||
[node name="DropOffPoint" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 598.689, 109.852 )
|
||||
|
||||
[node name="DropOffPoint2" parent="DropOffPointList" instance=ExtResource( 4 )]
|
||||
position = Vector2( 309.47, 613.175 )
|
||||
[node name="DropOffPoint2" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 473.58, 240.953 )
|
||||
|
||||
[node name="DropOffPoint3" parent="DropOffPointList" instance=ExtResource( 4 )]
|
||||
position = Vector2( 139.447, 276.017 )
|
||||
[node name="DropOffPoint3" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 119.23, 333.099 )
|
||||
|
||||
[node name="DropOffPoint4" parent="DropOffPointList" instance=ExtResource( 4 )]
|
||||
[node name="DropOffPoint4" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 717.693, 517.047 )
|
||||
|
||||
[node name="DropOffPoint5" parent="DropOffPointList" instance=ExtResource( 4 )]
|
||||
[node name="DropOffPoint5" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 906.682, 242.385 )
|
||||
|
||||
[node name="DropOffPoint6" parent="DropOffPointList" instance=ExtResource( 4 )]
|
||||
[node name="DropOffPoint6" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 1159.93, 112.613 )
|
||||
|
||||
[node name="DropOffPoint7" parent="DropOffPointList" instance=ExtResource( 4 )]
|
||||
[node name="DropOffPoint7" parent="DropOffPoints" instance=ExtResource( 4 )]
|
||||
position = Vector2( 1109.53, 624.141 )
|
||||
|
||||
[node name="GuestTimer" type="Timer" parent="."]
|
||||
@ -1490,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"]
|
||||
|
@ -28,11 +28,11 @@ 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)
|
||||
|
Loading…
Reference in New Issue
Block a user