Skip to content

Commit 8905dfe

Browse files
committed
SVG Icons! (;
Cleanup Explosion! using queue_free() from Animationplayer(: Player.Explode() moved to Game.Explode() Hide Mouse on fullscreen ^.^ Remove TitlePlayerSprite, made obsolete last commit!
1 parent c6e0130 commit 8905dfe

16 files changed

+165
-148
lines changed

Image/picon.png

-187 Bytes
Binary file not shown.

Image/picon.svg

Lines changed: 99 additions & 0 deletions
Loading

icon.png.import renamed to Image/picon.svg.import

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
importer="texture"
44
type="CompressedTexture2D"
5-
uid="uid://beqawweigqyo7"
6-
path="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"
5+
uid="uid://cnn14avycymbg"
6+
path="res://.godot/imported/picon.svg-e410375a78da9b999034f0237a4f76e0.ctex"
77
metadata={
88
"vram_texture": false
99
}
1010

1111
[deps]
1212

13-
source_file="res://icon.png"
14-
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.ctex"]
13+
source_file="res://Image/picon.svg"
14+
dest_files=["res://.godot/imported/picon.svg-e410375a78da9b999034f0237a4f76e0.ctex"]
1515

1616
[params]
1717

@@ -32,3 +32,6 @@ process/hdr_as_srgb=false
3232
process/hdr_clamp_exposure=false
3333
process/size_limit=0
3434
detect_3d/compress_to=1
35+
svg/scale=1.0
36+
editor/scale_with_editor_scale=false
37+
editor/convert_colors_with_editor_theme=false

Scene/Explosion.tscn

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
[gd_scene load_steps=6 format=3 uid="uid://c2pdo2im2v8d1"]
1+
[gd_scene load_steps=5 format=3 uid="uid://c2pdo2im2v8d1"]
22

3-
[ext_resource type="Script" path="res://Script/Explosion.gd" id="1"]
43
[ext_resource type="Texture2D" uid="uid://d24wavdwab2qx" path="res://Image/Explosion.png" id="2"]
54
[ext_resource type="AudioStream" uid="uid://b31exg3ofm45k" path="res://Audio/Death.ogg" id="3"]
65

@@ -30,7 +29,7 @@ tracks/1/keys = {
3029
"transitions": PackedFloat32Array(1),
3130
"values": [{
3231
"args": [],
33-
"method": &"End"
32+
"method": &"queue_free"
3433
}]
3534
}
3635

@@ -40,7 +39,6 @@ _data = {
4039
}
4140

4241
[node name="Explosion" type="Node2D"]
43-
script = ExtResource("1")
4442

4543
[node name="Sprite2D" type="Sprite2D" parent="."]
4644
texture = ExtResource("2")

Scene/TitlePlayerSprite.tscn

Lines changed: 0 additions & 37 deletions
This file was deleted.

Script/CandySpawner.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extends Node2D
22

3-
var delay = 3
4-
var timer = 0
3+
var delay := 3.0
4+
var timer := 0.0
55

66
var candy_tex = preload("res://Image/Candy.png")
77

@@ -11,7 +11,7 @@ var idle := []
1111
func _ready():
1212
randomize()
1313
delay = lerp(3.0, 0.333, global.level / global.lastLevel)
14-
if global.level == 21:
14+
if global.level == global.lastLevel:
1515
delay = 0.15
1616

1717
func _process(delta):

Script/Explosion.gd

Lines changed: 0 additions & 6 deletions
This file was deleted.

Script/Game.gd

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
extends Node2D
22

3-
var tmpath = "res://TileMap/"
3+
var tmpath := "res://TileMap/"
44
enum {TILE_WALL = 0, TILE_PLAYER = 1, TILE_GOOBER = 2}
5+
var NodeTileMap
56

67
var ScenePlayer = load("res://Scene/Player.tscn")
78
var SceneGoober = load("res://Scene/Goober.tscn")
9+
var SceneExplo = load("res://Scene/Explosion.tscn")
810

9-
var NodeTileMap
1011
@onready var NodeGoobers := $Goobers
1112
@onready var NodeAudioWin := $Audio/Win
1213
@onready var NodeAudioLose := $Audio/Lose
1314
@onready var NodeSprite := $Sprite2D
1415

15-
var check = false
16-
1716
var clock := 0.0
18-
var delay = 1.5
19-
var change = false
17+
var delay := 1.5
18+
var check := false
19+
var change := false
2020

2121
func _ready():
2222
global.Game = self
@@ -62,7 +62,7 @@ func MapStart():
6262
var p = id == TILE_PLAYER
6363
print(pos, ": Player" if p else ": Goober")
6464
var inst = (ScenePlayer if p else SceneGoober).instantiate()
65-
inst.position = NodeTileMap.map_to_local(pos) + Vector2(4, 0)
65+
inst.position = NodeTileMap.map_to_local(pos) + Vector2(4, 0 if p else 1)
6666
(self if p else NodeGoobers).add_child(inst)
6767
# remove tile from map
6868
NodeTileMap.set_cell(0, pos, -1)
@@ -101,3 +101,8 @@ func Win():
101101
func DoChange():
102102
change = false
103103
get_tree().reload_current_scene()
104+
105+
func Explode(arg : Vector2):
106+
var xpl = SceneExplo.instantiate()
107+
xpl.position = arg
108+
add_child(xpl)

Script/Global.gd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extends Node2D
22

3-
var level = 0
4-
var lastLevel = 21
3+
var level := 0
4+
var lastLevel := 21
55
var Game
66

77
var OST = load("res://Audio/OST.ogg")
@@ -18,7 +18,9 @@ func _ready():
1818

1919
func _input(event):
2020
if event.is_action_pressed("ui_fullscreen"):
21-
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN else DisplayServer.WINDOW_MODE_FULLSCREEN)
21+
var win_full = DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN
22+
DisplayServer.mouse_set_mode(DisplayServer.MOUSE_MODE_VISIBLE if win_full else DisplayServer.MOUSE_MODE_HIDDEN)
23+
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED if win_full else DisplayServer.WINDOW_MODE_FULLSCREEN)
2224

2325
func wrapp(pos := Vector2.ZERO):
2426
return Vector2(wrapf(pos.x, 0.0, 144.0), wrapf(pos.y, 0.0, 144.0))

Script/Goober.gd

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,34 @@ class_name Goober
44
@onready var NodeCast := $RayCast2D
55
@onready var NodeSprite := $Sprite2D
66

7-
var spd = 30
8-
var vel = Vector2.ZERO
7+
var spd := 30.0
8+
var vel := Vector2(spd, 0.001)
9+
var flip_clock := 1.0
910

1011
func _ready():
11-
# snap to floor
12-
move_and_collide(Vector2(0, 3))
13-
vel = Vector2(spd, 0)
1412
# change starting direction
1513
randomize()
1614
if randf() > 0.5:
17-
vel.x = -vel.x
18-
NodeSprite.flip_h = true
15+
flip()
1916

2017
func _physics_process(delta):
18+
flip_clock += delta
19+
2120
if !NodeCast.is_colliding():
2221
flip()
2322

2423
velocity = vel
2524
move_and_slide()
2625
if velocity.x == 0:
2726
flip()
27+
2828
position = global.wrapp(position)
2929

3030
func flip():
31+
if flip_clock < 0.1: return
3132
vel.x = -vel.x
3233
NodeSprite.flip_h = !NodeSprite.flip_h
34+
flip_clock = 0.0
3335

3436

3537

0 commit comments

Comments
 (0)