Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Game juicing demo added * Removed unnecessary sprites, added missing effects * Fixed some effects not working after restart
- Loading branch information
1 parent
7dbf672
commit 47070ea
Showing
86 changed files
with
2,157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
extends Node | ||
class_name ActiveJuices | ||
|
||
const HEALTH_MODIFIER : = 0.25 | ||
|
||
var sound : = false | ||
var tweening : = false | ||
var particles : = false | ||
var visual_fx : = false | ||
var rapid_fire : = false | ||
var weak_enemies : = false | ||
var bullet_spread : = false | ||
var bigger_bullets : = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[gd_scene load_steps=2 format=2] | ||
|
||
[ext_resource path="res://assets/sprites/bulletBlue1.png" type="Texture" id=1] | ||
|
||
[node name="Cartridge" type="Node2D"] | ||
editor/display_folded = true | ||
|
||
[node name="Sprite" type="Sprite" parent="."] | ||
texture = ExtResource( 1 ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
extends Node2D | ||
|
||
onready var tween : Tween = $Tween | ||
|
||
export var cartridge : PackedScene | ||
export var min_distance : = 25.0 | ||
export var max_distance : = 50.0 | ||
|
||
var enabled : = false | ||
|
||
|
||
func _ready() -> void: | ||
enabled = ActiveJuices.visual_fx | ||
randomize() | ||
|
||
|
||
func expell() -> void: | ||
if not enabled: | ||
return | ||
var cartridge_position = global_position + Vector2(randf(), randf()).normalized() * rand_range(min_distance, max_distance) | ||
var new_cartridge : = cartridge.instance() | ||
new_cartridge.global_position = global_position | ||
new_cartridge.rotation_degrees = randi() % 360 | ||
new_cartridge.set_as_toplevel(true) | ||
add_child(new_cartridge) | ||
tween.interpolate_property(new_cartridge, | ||
"global_position", | ||
new_cartridge.global_position, | ||
cartridge_position, | ||
0.3, | ||
Tween.TRANS_CUBIC, | ||
Tween.EASE_OUT) | ||
tween.start() | ||
|
||
|
||
func _on_Barrel_shot() -> void: | ||
expell() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
extends Node2D | ||
|
||
onready var audio_player : AudioStreamPlayer = $AudioStreamPlayer | ||
|
||
|
||
func _ready() -> void: | ||
$AnimatedSprite.play("explosion") | ||
if ActiveJuices.sound: | ||
audio_player.play() | ||
|
||
|
||
func _on_AnimatedSprite_animation_finished() -> void: | ||
queue_free() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[gd_scene load_steps=9 format=2] | ||
|
||
[ext_resource path="res://FX/Explosion.gd" type="Script" id=1] | ||
[ext_resource path="res://assets/sprites/explosion1.png" type="Texture" id=2] | ||
[ext_resource path="res://assets/sprites/explosion2.png" type="Texture" id=3] | ||
[ext_resource path="res://assets/sprites/explosion3.png" type="Texture" id=4] | ||
[ext_resource path="res://assets/sprites/explosion4.png" type="Texture" id=5] | ||
[ext_resource path="res://assets/sprites/explosion5.png" type="Texture" id=6] | ||
[ext_resource path="res://assets/audio/explosion.wav" type="AudioStream" id=7] | ||
|
||
[sub_resource type="SpriteFrames" id=1] | ||
|
||
animations = [ { | ||
"frames": [ ExtResource( 2 ), ExtResource( 3 ), ExtResource( 4 ), ExtResource( 5 ), ExtResource( 6 ) ], | ||
"loop": false, | ||
"name": "explosion", | ||
"speed": 10.0 | ||
} ] | ||
|
||
[node name="Explosion" type="Node2D" groups=[ | ||
"FX", | ||
]] | ||
z_index = 5 | ||
script = ExtResource( 1 ) | ||
|
||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."] | ||
frames = SubResource( 1 ) | ||
animation = "explosion" | ||
|
||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] | ||
stream = ExtResource( 7 ) | ||
|
||
[connection signal="animation_finished" from="AnimatedSprite" to="." method="_on_AnimatedSprite_animation_finished"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extends Node | ||
|
||
export var delay_mseconds : = 15 | ||
|
||
var enabled : = false | ||
|
||
func _ready() -> void: | ||
for frame_freezer in get_tree().get_nodes_in_group("frame_freezer"): | ||
frame_freezer.connect("frame_freeze_requested", self, "_on_frame_freeze_requested") | ||
|
||
|
||
func _on_frame_freeze_requested() -> void: | ||
if not enabled: | ||
return | ||
OS.delay_msec(delay_mseconds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
extends Node | ||
|
||
export var level : PackedScene | ||
|
||
|
||
func _on_JuiceControls_game_restarted() -> void: | ||
$Level.queue_free() | ||
yield(get_tree(), "idle_frame") | ||
add_child(level.instance()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[gd_scene load_steps=5 format=2] | ||
|
||
[ext_resource path="res://Game.gd" type="Script" id=1] | ||
[ext_resource path="res://levels/Level.tscn" type="PackedScene" id=2] | ||
[ext_resource path="res://interface/JuiceControls.tscn" type="PackedScene" id=3] | ||
[ext_resource path="res://FX/FrameFreezer.gd" type="Script" id=4] | ||
|
||
[node name="Game" type="Node"] | ||
script = ExtResource( 1 ) | ||
level = ExtResource( 2 ) | ||
|
||
[node name="Level" parent="." instance=ExtResource( 2 )] | ||
max_spawn_time = 8.0 | ||
|
||
[node name="JuiceControls" parent="." instance=ExtResource( 3 )] | ||
|
||
[node name="FrameFreezer" type="Node" parent="." groups=[ | ||
"freezer", | ||
]] | ||
script = ExtResource( 4 ) | ||
|
||
[connection signal="game_restarted" from="JuiceControls" to="." method="_on_JuiceControls_game_restarted"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
extends KinematicBody2D | ||
class_name Enemy | ||
|
||
onready var animation_player : AnimationPlayer = $AnimationPlayer | ||
onready var audio_player : AudioStreamPlayer = $AudioStreamPlayer | ||
|
||
export var health : = 100.0 | ||
export var move_speed : = 75 | ||
export var explosion : PackedScene | ||
|
||
var path : = [] | ||
var player : Node2D | ||
|
||
|
||
func _ready() -> void: | ||
health *= ActiveJuices.HEALTH_MODIFIER if ActiveJuices.weak_enemies else 1 | ||
|
||
|
||
func _physics_process(delta: float) -> void: | ||
path = get_parent().get_simple_path(global_position, player.global_position) | ||
var direction = (path[1] - global_position).normalized() | ||
look_at(path[1]) | ||
move_and_slide(direction * move_speed) | ||
|
||
|
||
func initialize(_player: Node2D) -> void: | ||
player = _player | ||
|
||
|
||
func damage(value: int) -> void: | ||
health = max(0, health - value) | ||
if ActiveJuices.visual_fx: | ||
animation_player.play("damaged") | ||
if ActiveJuices.sound: | ||
audio_player.play() | ||
if health == 0: | ||
if ActiveJuices.visual_fx: | ||
var new_explosion : = explosion.instance() | ||
new_explosion.global_position = global_position | ||
get_tree().get_root().add_child(new_explosion) | ||
queue_free() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
[gd_scene load_steps=8 format=2] | ||
|
||
[ext_resource path="res://actors/enemies/Enemy.gd" type="Script" id=1] | ||
[ext_resource path="res://FX/Explosion.tscn" type="PackedScene" id=2] | ||
[ext_resource path="res://assets/sprites/tankBody_red_outline.png" type="Texture" id=3] | ||
[ext_resource path="res://assets/sprites/tankDark_barrel1_outline.png" type="Texture" id=4] | ||
[ext_resource path="res://assets/audio/hit.wav" type="AudioStream" id=5] | ||
|
||
[sub_resource type="RectangleShape2D" id=1] | ||
|
||
extents = Vector2( 38.7491, 37.3242 ) | ||
|
||
[sub_resource type="Animation" id=2] | ||
|
||
resource_name = "damaged" | ||
length = 0.2 | ||
tracks/0/type = "value" | ||
tracks/0/path = NodePath(".:modulate") | ||
tracks/0/interp = 1 | ||
tracks/0/loop_wrap = true | ||
tracks/0/imported = false | ||
tracks/0/enabled = true | ||
tracks/0/keys = { | ||
"times": PoolRealArray( 0, 0.1, 0.2 ), | ||
"transitions": PoolRealArray( 1, 0.241484, 1 ), | ||
"update": 0, | ||
"values": [ Color( 1, 1, 1, 1 ), Color( 10, 10, 10, 1 ), Color( 1, 1, 1, 1 ) ] | ||
} | ||
|
||
[node name="Enemy" type="KinematicBody2D" groups=[ | ||
"enemies", | ||
]] | ||
z_index = 4 | ||
script = ExtResource( 1 ) | ||
explosion = ExtResource( 2 ) | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
shape = SubResource( 1 ) | ||
|
||
[node name="Sprite" type="Sprite" parent="."] | ||
rotation = -1.5708 | ||
texture = ExtResource( 3 ) | ||
|
||
[node name="Barrel" type="Position2D" parent="."] | ||
editor/display_folded = true | ||
rotation = -1.5708 | ||
|
||
[node name="Sprite" type="Sprite" parent="Barrel"] | ||
position = Vector2( 0, 11 ) | ||
texture = ExtResource( 4 ) | ||
|
||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] | ||
anims/damaged = SubResource( 2 ) | ||
|
||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] | ||
stream = ExtResource( 5 ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
extends Position2D | ||
|
||
signal shot | ||
signal camera_shake_requested | ||
signal frame_freeze_requested | ||
|
||
onready var timer : Timer = $Timer | ||
onready var spawn_position : Position2D = $SpawnPosition | ||
onready var audio_player : AudioStreamPlayer = $AudioStreamPlayer | ||
onready var animation_player : AnimationPlayer = $AnimationPlayer | ||
|
||
export var fire_rate : = 5 setget set_fire_rate | ||
export var bullet : PackedScene | ||
|
||
|
||
func _process(delta: float) -> void: | ||
look_at(get_global_mouse_position()) | ||
if Input.is_action_pressed("shoot") and timer.is_stopped(): | ||
shoot() | ||
|
||
|
||
func _on_Bullet_destroyed(enemy_hit: bool) -> void: | ||
if enemy_hit: | ||
emit_signal("camera_shake_requested") | ||
emit_signal("frame_freeze_requested") | ||
|
||
|
||
func shoot() -> void: | ||
timer.start() | ||
emit_signal("shot") | ||
if ActiveJuices.sound: | ||
audio_player.play() | ||
if ActiveJuices.visual_fx: | ||
animation_player.play("shoot") | ||
var new_bullet = bullet.instance() | ||
new_bullet.initialize((get_global_mouse_position() - global_position).normalized()) | ||
add_child(new_bullet) | ||
new_bullet.global_position = spawn_position.global_position | ||
new_bullet.look_at(get_global_mouse_position()) | ||
new_bullet.connect("destroyed", self, "_on_Bullet_destroyed") | ||
|
||
func set_fire_rate(value: int) -> void: | ||
fire_rate = value | ||
timer.wait_time = 1.0 / fire_rate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
extends KinematicBody2D | ||
|
||
export var move_speed : = 150.0 | ||
export var turn_speed : = 75.0 | ||
|
||
func _physics_process(delta: float) -> void: | ||
var motion : = Vector2() | ||
motion.y = Input.get_action_strength("move_backward") - Input.get_action_strength("move_forward") | ||
motion.x = Input.get_action_strength("rotate_right") - Input.get_action_strength("rotate_left") | ||
|
||
rotation_degrees += motion.x * turn_speed * delta | ||
|
||
move_and_slide(Vector2.UP.rotated(rotation) * motion.y * move_speed) | ||
|
Oops, something went wrong.