Browse Source

Redo menu

Menu redone looking bueno
master
Abheek Dhawan 4 years ago
parent
commit
a7333e51d7
  1. BIN
      Fonts/BigShouldersDisplay-Medium.ttf
  2. 28
      Game Scenes/Game.tscn
  3. 49
      Game Scenes/Main Menu.tscn
  4. BIN
      Images and Anims/In Game/.DS_Store
  5. BIN
      Images and Anims/In Game/background.png
  6. BIN
      Images and Anims/In Game/background.png.bak
  7. BIN
      Images and Anims/In Game/pausebutton.png
  8. 34
      Images and Anims/In Game/pausebutton.png.import
  9. BIN
      Images and Anims/In Game/playbutton.png
  10. 34
      Images and Anims/In Game/playbutton.png.import
  11. BIN
      Images and Anims/Other/icon.png
  12. 15
      Music and Sounds/menu.ogg.import
  13. 8
      Scripts/Game.gd
  14. 17
      Scripts/HiScoreLabel.gd
  15. 1
      Scripts/MenuCoinLabel.gd
  16. 31
      Scripts/MenuLabels.gd
  17. 4
      Scripts/PauseButton.gd
  18. 4
      Scripts/Rocket.gd
  19. 17
      Scripts/ScoreLabel.gd
  20. 4
      export_presets.cfg
  21. 2
      project.godot

BIN
Fonts/BigShouldersDisplay-Medium.ttf

Binary file not shown.

28
Game Scenes/Game.tscn

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=18 format=2]
[ext_resource path="res://Objects/Rocket.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scripts/Rocket.gd" type="Script" id=2]
@ -10,6 +10,7 @@
[ext_resource path="res://Music and Sounds/explosion.ogg" type="AudioStream" id=8]
[ext_resource path="res://Music and Sounds/astervoid-theme.ogg" type="AudioStream" id=9]
[ext_resource path="res://Music and Sounds/rocket-launch.ogg" type="AudioStream" id=10]
[ext_resource path="res://Images and Anims/In Game/playbutton.png" type="Texture" id=11]
[sub_resource type="AtlasTexture" id=1]
flags = 4
@ -82,10 +83,11 @@ __meta__ = {
position = Vector2( -8.0022, -34.2137 )
scale = Vector2( 0.401688, 0.401688 )
frames = SubResource( 6 )
frame = 1
frame = 3
playing = true
[node name="Theme Music" type="AudioStreamPlayer" parent="Rocket"]
pause_mode = 2
stream = ExtResource( 9 )
autoplay = true
@ -99,9 +101,25 @@ autoplay = true
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_scale = Vector2( 0.01, 0.01 )
motion_scale = Vector2( 0.1, 0.1 )
[node name="Background" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 89.4544, -100.794 )
scale = Vector2( 5, 5 )
position = Vector2( 174.306, -100.794 )
scale = Vector2( 7.46004, 7.46004 )
texture = ExtResource( 3 )
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="PauseButton" type="TextureButton" parent="CanvasLayer"]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -173.0
margin_top = -231.0
margin_right = -40.0
margin_bottom = -48.0
texture_normal = ExtResource( 11 )
__meta__ = {
"_edit_use_anchors_": false
}

49
Game Scenes/Main Menu.tscn

@ -1,13 +1,15 @@
[gd_scene load_steps=17 format=2]
[gd_scene load_steps=21 format=2]
[ext_resource path="res://Scripts/Text Container.gd" type="Script" id=1]
[ext_resource path="res://Objects/Rocket.tscn" type="PackedScene" id=2]
[ext_resource path="res://Images and Anims/In Game/background.png" type="Texture" id=3]
[ext_resource path="res://Fonts/FasterOne-Regular.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://Scripts/MenuCoinLabel.gd" type="Script" id=5]
[ext_resource path="res://Music and Sounds/menu.ogg" type="AudioStream" id=6]
[ext_resource path="res://Scripts/HiScoreLabel.gd" type="Script" id=6]
[ext_resource path="res://Images and Anims/In Game/coin.png" type="Texture" id=7]
[ext_resource path="res://Fonts/TurretRoad-Medium.ttf" type="DynamicFontData" id=8]
[ext_resource path="res://Scripts/ScoreLabel.gd" type="Script" id=9]
[ext_resource path="res://Fonts/BigShouldersDisplay-Medium.ttf" type="DynamicFontData" id=10]
[sub_resource type="DynamicFont" id=1]
size = 96
@ -52,6 +54,18 @@ animations = [ {
"speed": 8.0
} ]
[sub_resource type="DynamicFont" id=9]
size = 24
outline_size = 1
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 10 )
[sub_resource type="DynamicFont" id=10]
size = 24
outline_size = 1
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 10 )
[node name="MarginContainer" type="MarginContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
@ -83,7 +97,6 @@ position = Vector2( 0, -34 )
scale = Vector2( 10, 10 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="HBoxContainer/VBoxContainer/CenterContainer/Rocket"]
stream = ExtResource( 6 )
autoplay = true
[node name="TextContainer" type="Node2D" parent="HBoxContainer/VBoxContainer/CenterContainer"]
@ -118,7 +131,7 @@ position = Vector2( 0, -576 )
scale = Vector2( 3, 3 )
frames = SubResource( 8 )
animation = "spin"
frame = 3
frame = 1
playing = true
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/Coin"]
@ -133,6 +146,34 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Label3" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/Coin"]
margin_left = -110.0
margin_top = 129.667
margin_right = -63.0
margin_bottom = 143.667
custom_fonts/font = SubResource( 9 )
align = 1
valign = 1
uppercase = true
script = ExtResource( 9 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label4" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/Coin"]
margin_left = 55.333
margin_top = 130.0
margin_right = 102.333
margin_bottom = 144.0
custom_fonts/font = SubResource( 10 )
align = 1
valign = 1
uppercase = true
script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" type="Sprite" parent="."]
position = Vector2( -205.108, 755.715 )
scale = Vector2( 4.46278, 4.46278 )

BIN
Images and Anims/In Game/.DS_Store

Binary file not shown.

BIN
Images and Anims/In Game/background.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 2.4 MiB

BIN
Images and Anims/In Game/background.png.bak

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

BIN
Images and Anims/In Game/pausebutton.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

34
Images and Anims/In Game/pausebutton.png.import

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/pausebutton.png-fce1a35638d9c9e5e5680ee254349c04.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images and Anims/In Game/pausebutton.png"
dest_files=[ "res://.import/pausebutton.png-fce1a35638d9c9e5e5680ee254349c04.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

BIN
Images and Anims/In Game/playbutton.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

34
Images and Anims/In Game/playbutton.png.import

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/playbutton.png-f46f169e8e383816c2f7e25c5dc62b3c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Images and Anims/In Game/playbutton.png"
dest_files=[ "res://.import/playbutton.png-f46f169e8e383816c2f7e25c5dc62b3c.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

BIN
Images and Anims/Other/icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

15
Music and Sounds/menu.ogg.import

@ -1,15 +0,0 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/menu.ogg-98e0c28691ee2b4507b45873b3dde0d1.oggstr"
[deps]
source_file="res://Music and Sounds/menu.ogg"
dest_files=[ "res://.import/menu.ogg-98e0c28691ee2b4507b45873b3dde0d1.oggstr" ]
[params]
loop=true
loop_offset=0

8
Scripts/Game.gd

@ -8,6 +8,7 @@ var deltaSpawnTime = 1
var asteroidSpawnRepeat = 0
var hiscore = 0
var numOfCoins = 0
var lastscore = 0
onready var rocketNode = get_node("Rocket")
func load_game():
@ -22,9 +23,11 @@ func load_game():
func _ready():
load_game()
$CanvasLayer/PauseButton.connect("pressed", self, "_pause_game")
func _process(delta):
if rocketNode.collided:
lastscore = $"Rocket".lastscore
save_data()
spawnTime = 500/get_viewport_rect().size.x * deltaSpawnTime
time += delta
@ -50,10 +53,15 @@ func _process(delta):
func save():
var save_dict = {
"hiscore" : hiscore,
"lastscore" : lastscore,
"numOfCoins" : numOfCoins
}
return save_dict
func _pause_game():
print(get_tree().paused)
get_tree().paused = !get_tree().paused
func save_data():
var save_game = File.new()
save_game.open("user://savegame.save", File.WRITE)

17
Scripts/HiScoreLabel.gd

@ -0,0 +1,17 @@
extends Label
var hiscore = 0
func load_game():
var save_game = File.new()
if not save_game.file_exists("user://savegame.save"):
return
save_game.open("user://savegame.save", File.READ)
while save_game.get_position() < save_game.get_len():
var data = parse_json(save_game.get_line())
hiscore = data["hiscore"]
func _ready():
load_game()
text="Hi-Score\n" + str(round(hiscore))

1
Scripts/MenuCoinLabel.gd

@ -16,4 +16,3 @@ func load_game():
func _ready():
load_game()
text = str(numOfCoins)

31
Scripts/MenuLabels.gd

@ -0,0 +1,31 @@
extends Node2D
var lastscore = 0
var hiscore = 0
func load_game():
var save_game = File.new()
if not save_game.file_exists("user://savegame.save"):
return
save_game.open("user://savegame.save", File.READ)
while save_game.get_position() < save_game.get_len():
var data = parse_json(save_game.get_line())
# lastscore = data["lastscore"]
hiscore = data["hiscore"]
func _ready():
load_game()
var ScoreLabel = Label.new()
add_child(ScoreLabel)
ScoreLabel.set_owner(get_tree().get_edited_scene_root())
var HiScoreLabel = Label.new()
add_child(HiScoreLabel)
HiScoreLabel.set_owner(get_tree().get_edited_scene_root())
ScoreLabel.text = str(lastscore)
HiScoreLabel.text = str(hiscore)
print(ScoreLabel.text)
print (HiScoreLabel.text)
print(HiScoreLabel.rect_position)

4
Scripts/PauseButton.gd

@ -0,0 +1,4 @@
extends Button
func _process(delta):

4
Scripts/Rocket.gd

@ -7,6 +7,7 @@ var explosionObj = load("res://Objects/Explosion.tscn")
var collided = false
var isScreenPressed = false
var screenPressLocation = get_viewport().get_rect().size/2
var lastscore
onready var gameNode = get_node("/root/Game")
func _ready():
@ -19,9 +20,8 @@ func _process(delta):
var score = -position.y/10
var collision = move_and_collide(Vector2(difficulty * sin(angle) * delta, -difficulty * cos(angle) * delta))
if collision:
# $"Theme Music".stop()
$Explosion.play()
var lastscore = score
lastscore = score
if score > gameNode.hiscore:
gameNode.hiscore = score
score = 0

17
Scripts/ScoreLabel.gd

@ -0,0 +1,17 @@
extends Label
var lastscore = 0
func load_game():
var save_game = File.new()
if not save_game.file_exists("user://savegame.save"):
return
save_game.open("user://savegame.save", File.READ)
while save_game.get_position() < save_game.get_len():
var data = parse_json(save_game.get_line())
lastscore = data["lastscore"]
func _ready():
load_game()
text="Score\n" + str(round(lastscore))

4
export_presets.cfg

@ -137,7 +137,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../iOS/Version 2.0/Build 2.0/astervoid.ipa"
export_path="../iOS Builds/2.8/astervoid.ipa"
patch_list=PoolStringArray( )
script_export_mode=1
script_encryption_key=""
@ -158,7 +158,7 @@ application/info="Made with Godot Engine"
application/identifier="com.ADAwesomeGames.AsterVoid"
application/signature=""
application/short_version="2.0"
application/version="2.3"
application/version="2.8"
application/copyright="2021 AD Awesome Games"
capabilities/arkit=false
capabilities/camera=false

2
project.godot

@ -25,6 +25,8 @@ config/icon="res://Images and Anims/Other/icon.png"
window/size/width=828
window/size/height=1792
window/stretch/mode="viewport"
window/stretch/aspect="expand"
[input]

Loading…
Cancel
Save