aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gräf <romangraef@gmail.com>2020-04-19 17:35:14 +0200
committerRoman Gräf <romangraef@gmail.com>2020-04-19 17:35:14 +0200
commite72709b75ab3c21b46f744466601e3e61f3d2b71 (patch)
tree264e39429a46c06d5c5c17d290ebf0ea3ba4cd06
parente1d6ed5ec8d8ce4f6b507dcd9e4d65182805a1c9 (diff)
downloadLDJam46-e72709b75ab3c21b46f744466601e3e61f3d2b71.tar.gz
LDJam46-e72709b75ab3c21b46f744466601e3e61f3d2b71.tar.bz2
LDJam46-e72709b75ab3c21b46f744466601e3e61f3d2b71.zip
Laser Devs
-rw-r--r--assets/lasergabel.PNG.import34
-rw-r--r--riot/angrydev.gd32
-rw-r--r--riot/angrydev.tscn7
-rw-r--r--riot/laser_blast.gd7
-rw-r--r--riot/laser_blast.tscn9
-rw-r--r--riot/riot.tscn3
-rw-r--r--save_state.gd2
7 files changed, 79 insertions, 15 deletions
diff --git a/assets/lasergabel.PNG.import b/assets/lasergabel.PNG.import
new file mode 100644
index 0000000..5785c86
--- /dev/null
+++ b/assets/lasergabel.PNG.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="StreamTexture"
+path="res://.import/lasergabel.PNG-5230d345917dab97f6518a2be49230d2.stex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://assets/lasergabel.PNG"
+dest_files=[ "res://.import/lasergabel.PNG-5230d345917dab97f6518a2be49230d2.stex" ]
+
+[params]
+
+compress/mode=0
+compress/lossy_quality=0.7
+compress/hdr_mode=0
+compress/bptc_ldr=0
+compress/normal_map=0
+flags/repeat=0
+flags/filter=true
+flags/mipmaps=false
+flags/anisotropic=false
+flags/srgb=2
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/HDR_as_SRGB=false
+process/invert_color=false
+stream=false
+size_limit=0
+detect_3d=true
+svg/scale=1.0
diff --git a/riot/angrydev.gd b/riot/angrydev.gd
index 580de32..c56c9d9 100644
--- a/riot/angrydev.gd
+++ b/riot/angrydev.gd
@@ -4,25 +4,30 @@ class_name AngryDev
var min_pitchfork_rotation : float = -15.0
var max_pitchfork_rotation : float = 50.0
export var rotation_speed : float = 1
-var target: Manager = null
+var target: Node2D = null
var total_tick = 0.0
export var speed : float = 100.0
onready var pitchfork : Sprite = $pitchfork
onready var body : Sprite = $body
export (Texture) var laser_pitchfork_texture: Texture = null
var laser = false
+onready var pitchfork_nuzzle : Node2D = $pitchfork/nuzzle
+var shooting_windup = 10000000
+var shoot_direction = null
+var laser_blast_blueprint = preload("res://riot/laser_blast.tscn")
func _ready():
if SaveState.has_upgrade("sunglasses"):
- laser = true
+ shooting_windup = 5
pitchfork.texture = laser_pitchfork_texture
func interpolate(a, b, progress):
return a + (b-a) * progress
func _process(delta : float) -> void:
- if laser:
- pitchfork.rotation = get_angle_to(target.position) + PI / 2
+ if shooting_windup < 3:
+ if shooting_windup > 0.2:
+ pitchfork.rotation = get_angle_to(target.position) + PI / 2
return
total_tick += delta
var normalized_progress = (sin(total_tick * rotation_speed) + 1.0) / 2.0
@@ -31,13 +36,20 @@ func _process(delta : float) -> void:
func _physics_process(delta: float) -> void:
- if laser:
+ shooting_windup -= delta
+ var normalized_move = (target.position - position).normalized()
+ if shooting_windup <= 0.2 and shoot_direction == null:
+ shoot_direction = normalized_move
+ if shooting_windup <= 0:
+ var laser_blast = laser_blast_blueprint.instance()
+ laser_blast.position = pitchfork_nuzzle.position
+ laser_blast.move = shoot_direction
+ laser_blast.rotation = Vector2(0,0).angle_to_point(shoot_direction) + PI / 2
+ shoot_direction = null
+ add_child(laser_blast)
+ shooting_windup = rand_range(8, 12)
+ if shooting_windup < 3:
return
- var normalized_move = (target.position - body.position).normalized()
position += normalized_move * delta * speed
-
-func rotate_towards(player: Node2D) -> void:
- if player.position.x > position.x:
- scale.x = -abs(scale.x)
diff --git a/riot/angrydev.tscn b/riot/angrydev.tscn
index a987ff7..dc80f17 100644
--- a/riot/angrydev.tscn
+++ b/riot/angrydev.tscn
@@ -1,8 +1,9 @@
-[gd_scene load_steps=6 format=2]
+[gd_scene load_steps=7 format=2]
[ext_resource path="res://assets/idle_devs.tres" type="Texture" id=1]
[ext_resource path="res://assets/pitchfork.png" type="Texture" id=2]
[ext_resource path="res://riot/angrydev.gd" type="Script" id=3]
+[ext_resource path="res://assets/lasergabel.PNG" type="Texture" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 60.093, 116.278 )
@@ -14,6 +15,7 @@ extents = Vector2( 7.90784, 32.0742 )
position = Vector2( -24.1174, 33.1615 )
script = ExtResource( 3 )
speed = 80.0
+laser_pitchfork_texture = ExtResource( 4 )
[node name="body" type="Sprite" parent="."]
position = Vector2( 43.416, -38.1387 )
@@ -36,3 +38,6 @@ offset = Vector2( 0.330124, -33.3885 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="pitchfork/Area2D"]
position = Vector2( 0.128513, -33.3091 )
shape = SubResource( 2 )
+
+[node name="nuzzle" type="Node2D" parent="pitchfork"]
+position = Vector2( -1, -65.9999 )
diff --git a/riot/laser_blast.gd b/riot/laser_blast.gd
new file mode 100644
index 0000000..a0f2ed5
--- /dev/null
+++ b/riot/laser_blast.gd
@@ -0,0 +1,7 @@
+extends Sprite
+
+export var speed = 700.0
+var move: Vector2 = Vector2(0, 0)
+func _physics_process(delta):
+ move
+ position += move * delta * speed
diff --git a/riot/laser_blast.tscn b/riot/laser_blast.tscn
index 6a588fd..b3f760b 100644
--- a/riot/laser_blast.tscn
+++ b/riot/laser_blast.tscn
@@ -1,14 +1,17 @@
-[gd_scene load_steps=3 format=2]
+[gd_scene load_steps=4 format=2]
[ext_resource path="res://assets/laser_blast.png" type="Texture" id=1]
+[ext_resource path="res://riot/laser_blast.gd" type="Script" id=2]
[sub_resource type="RectangleShape2D" id=1]
-extents = Vector2( 32, 32 )
+extents = Vector2( 4.7049, 17.2208 )
[node name="Node2D" type="Sprite"]
+position = Vector2( 0.568802, 0 )
texture = ExtResource( 1 )
+script = ExtResource( 2 )
-[node name="Area2D" type="Area2D" parent="."]
+[node name="Area2D" type="KinematicBody2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource( 1 )
diff --git a/riot/riot.tscn b/riot/riot.tscn
index 77b6441..f80c768 100644
--- a/riot/riot.tscn
+++ b/riot/riot.tscn
@@ -21,3 +21,6 @@ shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="manager"]
texture = ExtResource( 2 )
+
+[node name="midpoint_marker" type="Node2D" parent="manager"]
+position = Vector2( -13.5661, -3.01468 )
diff --git a/save_state.gd b/save_state.gd
index 2ce8b0d..c5af6c2 100644
--- a/save_state.gd
+++ b/save_state.gd
@@ -6,7 +6,7 @@ var buildings = {
}
var upgrades = {
"wageslavery": 0,
- "sunglasses": 0,
+ "sunglasses": 1,
}
func has_upgrade(name):