Browse Source

Merge branch 'mobile' of https://git.adawesome.tech/git/games/spacescape2d into mobile

master
Abheek Dhawan 4 years ago
parent
commit
2ec94640ec
  1. 4
      Game Scenes/Game.tscn
  2. BIN
      Images and Anims/In Game/pausebutton.png
  3. 7
      Scripts/Game.gd

4
Game Scenes/Game.tscn

@ -83,11 +83,10 @@ __meta__ = {
position = Vector2( -8.0022, -34.2137 ) position = Vector2( -8.0022, -34.2137 )
scale = Vector2( 0.401688, 0.401688 ) scale = Vector2( 0.401688, 0.401688 )
frames = SubResource( 6 ) frames = SubResource( 6 )
frame = 3 frame = 1
playing = true playing = true
[node name="Theme Music" type="AudioStreamPlayer" parent="Rocket"] [node name="Theme Music" type="AudioStreamPlayer" parent="Rocket"]
pause_mode = 2
stream = ExtResource( 9 ) stream = ExtResource( 9 )
autoplay = true autoplay = true
@ -111,6 +110,7 @@ texture = ExtResource( 3 )
[node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="PauseButton" type="TextureButton" parent="CanvasLayer"] [node name="PauseButton" type="TextureButton" parent="CanvasLayer"]
pause_mode = 2
anchor_left = 1.0 anchor_left = 1.0
anchor_top = 1.0 anchor_top = 1.0
anchor_right = 1.0 anchor_right = 1.0

BIN
Images and Anims/In Game/pausebutton.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

7
Scripts/Game.gd

@ -9,6 +9,8 @@ var asteroidSpawnRepeat = 0
var hiscore = 0 var hiscore = 0
var numOfCoins = 0 var numOfCoins = 0
var lastscore = 0 var lastscore = 0
var pause_button = preload("res://Images and Anims/In Game/pausebutton.png")
var play_button = preload("res://Images and Anims/In Game/playbutton.png")
onready var rocketNode = get_node("Rocket") onready var rocketNode = get_node("Rocket")
func load_game(): func load_game():
@ -23,6 +25,7 @@ func load_game():
func _ready(): func _ready():
load_game() load_game()
$CanvasLayer/PauseButton.texture_normal = play_button
$CanvasLayer/PauseButton.connect("pressed", self, "_pause_game") $CanvasLayer/PauseButton.connect("pressed", self, "_pause_game")
func _process(delta): func _process(delta):
@ -61,6 +64,10 @@ func save():
func _pause_game(): func _pause_game():
print(get_tree().paused) print(get_tree().paused)
get_tree().paused = !get_tree().paused get_tree().paused = !get_tree().paused
if (!get_tree().paused):
$CanvasLayer/PauseButton.texture_normal = play_button
else:
$CanvasLayer/PauseButton.texture_normal = pause_button
func save_data(): func save_data():
var save_game = File.new() var save_game = File.new()

Loading…
Cancel
Save