Browse Source

Introduce save feature

Added a save feature (still a huge work in progress!)
master
Abheek Dhawan 4 years ago
parent
commit
f397a52749
  1. 16
      Game Scenes/Game.tscn
  2. BIN
      Images and Anims/In Game/.DS_Store
  3. 1
      Objects/Coin.gd
  4. 1
      Objects/Coin.tscn
  5. 5
      Scripts/CoinLabel.gd
  6. 2
      export_presets.cfg

16
Game Scenes/Game.tscn

@ -1,10 +1,11 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Objects/Rocket.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scripts/Rocket.gd" type="Script" id=2]
[ext_resource path="res://Images and Anims/In Game/background.png" type="Texture" id=3]
[ext_resource path="res://Scripts/Game.gd" type="Script" id=4]
[ext_resource path="res://Scripts/Score.gd" type="Script" id=5]
[ext_resource path="res://Scripts/CoinLabel.gd" type="Script" id=6]
[node name="Game" type="Node2D"]
script = ExtResource( 4 )
@ -19,7 +20,17 @@ offset = Vector2( 0, -220 )
current = true
smoothing_enabled = true
[node name="Label" type="Label" parent="Rocket"]
[node name="Coins" type="Label" parent="Rocket/Camera2D"]
margin_left = 166.0
margin_top = -254.0
margin_right = 250.0
margin_bottom = -239.0
script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Score" type="Label" parent="Rocket"]
margin_left = 13.0
margin_top = 9.0
margin_right = 44.0
@ -35,6 +46,7 @@ __meta__ = {
motion_scale = Vector2( 0.01, 0.01 )
[node name="Background" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
visible = false
position = Vector2( 89.4544, -100.794 )
scale = Vector2( 5, 5 )
texture = ExtResource( 3 )

BIN
Images and Anims/In Game/.DS_Store

Binary file not shown.

1
Objects/Coin.gd

@ -1,7 +1,6 @@
extends Area2D
func _on_Coin_body_entered(body):
print (body.name)
if body.name == "Rocket":
var numOfCoins = get_parent().get("numOfCoins")
numOfCoins += 1

1
Objects/Coin.tscn

@ -49,6 +49,5 @@ shape = SubResource( 1 )
scale = Vector2( 2, 2 )
frames = SubResource( 7 )
animation = "Spin"
frame = 2
playing = true
[connection signal="body_entered" from="." to="." method="_on_Coin_body_entered"]

5
Scripts/CoinLabel.gd

@ -0,0 +1,5 @@
extends Label
func _process(delta):
var coins = str(get_parent().get_parent().get_parent().get("numOfCoins"))
text = coins

2
export_presets.cfg

@ -7,7 +7,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="Builds/macOS/spacescape-macos.dmg"
export_path="../spacescape.dmg"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""

Loading…
Cancel
Save