Browse Source

Fix menu alignment bug

The menu aligned weirdly on larger screens, so I completely redid it. I
also fixed some music stuff.
master
Abheek Dhawan 4 years ago
parent
commit
8c36fcbc85
  1. 3
      .gitignore
  2. 18
      Game Scenes/Game.tscn
  3. 140
      Game Scenes/Main Menu.tscn
  4. 106
      Game Scenes/MainMenu.tscn
  5. 15
      Music and Sounds/astervoid-theme.ogg.import
  6. 15
      Music and Sounds/explosion.ogg.import
  7. 15
      Music and Sounds/menu.ogg.import
  8. 15
      Music and Sounds/rocket-launch.ogg.import
  9. 2
      Objects/Rocket.tscn
  10. 4
      Scripts/CoinLabel.gd
  11. 19
      Scripts/MenuCoinLabel.gd
  12. 8
      Scripts/Rocket.gd
  13. 2
      Scripts/Text Container.gd
  14. 6
      export_presets.cfg
  15. 2
      project.godot

3
.gitignore

@ -359,3 +359,6 @@ Images\ and\ Anims/.DS_Store
# Don't include deleted files import folder
.import/
.iOS/
# Don't include music
*.ogg

18
Game Scenes/Game.tscn

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=17 format=2]
[ext_resource path="res://Objects/Rocket.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scripts/Rocket.gd" type="Script" id=2]
@ -7,6 +7,9 @@
[ext_resource path="res://Scripts/Score.gd" type="Script" id=5]
[ext_resource path="res://Scripts/CoinLabel.gd" type="Script" id=6]
[ext_resource path="res://Images and Anims/In Game/coin.png" type="Texture" id=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]
[sub_resource type="AtlasTexture" id=1]
flags = 4
@ -79,9 +82,20 @@ __meta__ = {
position = Vector2( -8.0022, -34.2137 )
scale = Vector2( 0.401688, 0.401688 )
frames = SubResource( 6 )
frame = 4
frame = 1
playing = true
[node name="Theme Music" type="AudioStreamPlayer" parent="Rocket"]
stream = ExtResource( 9 )
autoplay = true
[node name="Explosion" type="AudioStreamPlayer" parent="Rocket"]
stream = ExtResource( 8 )
[node name="Launch" type="AudioStreamPlayer" parent="Rocket"]
stream = ExtResource( 10 )
autoplay = true
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]

140
Game Scenes/Main Menu.tscn

@ -0,0 +1,140 @@
[gd_scene load_steps=17 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://Images and Anims/In Game/coin.png" type="Texture" id=7]
[ext_resource path="res://Fonts/TurretRoad-Medium.ttf" type="DynamicFontData" id=8]
[sub_resource type="DynamicFont" id=1]
size = 96
use_filter = true
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=2]
size = 50
use_filter = true
font_data = ExtResource( 8 )
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 0, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 16, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=5]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 32, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=6]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 48, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=7]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 64, 0, 16, 16 )
[sub_resource type="SpriteFrames" id=8]
animations = [ {
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
"loop": true,
"name": "spin",
"speed": 8.0
} ]
[node name="MarginContainer" type="MarginContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 40.0
margin_top = 60.0
margin_right = -40.0
margin_bottom = -60.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_right = 748.0
margin_bottom = 1672.0
alignment = 1
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
margin_left = 374.0
margin_right = 374.0
margin_bottom = 1672.0
alignment = 1
[node name="CenterContainer" type="CenterContainer" parent="HBoxContainer/VBoxContainer"]
margin_top = 836.0
margin_bottom = 836.0
[node name="Rocket" parent="HBoxContainer/VBoxContainer/CenterContainer" instance=ExtResource( 2 )]
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"]
script = ExtResource( 1 )
[node name="Title" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/TextContainer"]
margin_left = -314.373
margin_top = -463.476
margin_right = 298.627
margin_bottom = -360.476
custom_fonts/font = SubResource( 1 )
text = "AsterVoid"
align = 1
valign = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Tap" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/TextContainer"]
margin_left = -145.271
margin_top = 575.036
margin_right = 133.729
margin_bottom = 631.036
custom_fonts/font = SubResource( 2 )
text = "Tap to play!"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Coin" type="AnimatedSprite" parent="HBoxContainer/VBoxContainer/CenterContainer"]
position = Vector2( 0, -576 )
scale = Vector2( 3, 3 )
frames = SubResource( 8 )
animation = "spin"
frame = 3
playing = true
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/Coin"]
margin_left = -20.0941
margin_top = 10.2118
margin_right = 19.9059
margin_bottom = 24.2118
align = 1
valign = 1
script = ExtResource( 5 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" type="Sprite" parent="."]
position = Vector2( -205.108, 755.715 )
scale = Vector2( 4.46278, 4.46278 )
z_index = -1
texture = ExtResource( 3 )

106
Game Scenes/MainMenu.tscn

@ -1,22 +1,64 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=16 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://Fonts/TurretRoad-Light.ttf" type="DynamicFontData" id=5]
[ext_resource path="res://Music and Sounds/menu.ogg" type="AudioStream" id=6]
[ext_resource path="res://Images and Anims/In Game/coin.png" type="Texture" id=7]
[sub_resource type="DynamicFont" id=1]
size = 156
size = 125
outline_size = 9
outline_color = Color( 0, 0, 0, 1 )
use_filter = true
font_data = ExtResource( 4 )
[sub_resource type="DynamicFont" id=2]
size = 100
font_data = ExtResource( 5 )
[sub_resource type="AtlasTexture" id=3]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 0, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=4]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 16, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=5]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 32, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=6]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 48, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=7]
flags = 4
atlas = ExtResource( 7 )
region = Rect2( 64, 0, 16, 16 )
[sub_resource type="SpriteFrames" id=8]
animations = [ {
"frames": [ SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
"loop": true,
"name": "default",
"speed": 8.0
} ]
[node name="MarginContainer" type="MarginContainer"]
anchor_right = 0.906
anchor_bottom = 0.744
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 80.0
margin_top = 120.0
margin_right = -80.0
margin_bottom = -120.0
custom_constants/margin_right = 120
custom_constants/margin_top = 80
custom_constants/margin_left = 120
@ -25,20 +67,33 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Rocket" parent="." instance=ExtResource( 2 )]
position = Vector2( 375, 600 )
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_left = 120.0
margin_top = 80.0
margin_right = 548.0
margin_bottom = 1472.0
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
margin_bottom = 1392.0
[node name="Rocket" parent="HBoxContainer/VBoxContainer" instance=ExtResource( 2 )]
position = Vector2( 203.049, 610.744 )
scale = Vector2( 10, 10 )
[node name="Text Container" type="Node2D" parent="."]
position = Vector2( 375, 700 )
[node name="Menu Music" type="AudioStreamPlayer" parent="HBoxContainer/VBoxContainer/Rocket"]
stream = ExtResource( 6 )
autoplay = true
[node name="Text Container" type="Node2D" parent="HBoxContainer/VBoxContainer"]
position = Vector2( 204.073, 604.439 )
scale = Vector2( 0.7, 0.7 )
script = ExtResource( 1 )
[node name="AsteroidDodge" type="Label" parent="Text Container"]
margin_left = -561.338
margin_top = -824.82
margin_right = 588.662
margin_bottom = -434.82
[node name="AsteroidDodge" type="Label" parent="HBoxContainer/VBoxContainer/Text Container"]
margin_left = -498.941
margin_top = -785.719
margin_right = 496.059
margin_bottom = -448.719
custom_fonts/font = SubResource( 1 )
text = "AsterVoid
"
@ -48,11 +103,11 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Tap" type="Label" parent="Text Container"]
margin_left = -264.901
margin_top = 682.457
margin_right = -191.901
margin_bottom = 696.457
[node name="Tap" type="Label" parent="HBoxContainer/VBoxContainer/Text Container"]
margin_left = -288.69
margin_top = 979.438
margin_right = 272.31
margin_bottom = 1089.44
custom_fonts/font = SubResource( 2 )
text = "Tap to play!"
align = 1
@ -61,7 +116,20 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Sprite" type="Sprite" parent="."]
[node name="AnimatedSprite" type="AnimatedSprite" parent="HBoxContainer/VBoxContainer"]
position = Vector2( 95.1149, 1.36029 )
scale = Vector2( 3.39608, 3.39608 )
frames = SubResource( 8 )
frame = 4
playing = true
[node name="CenterContainer" type="CenterContainer" parent="HBoxContainer"]
margin_left = 4.0
margin_right = 4.0
margin_bottom = 1392.0
[node name="Background" type="Sprite" parent="."]
visible = false
position = Vector2( 339.761, 738.579 )
scale = Vector2( 4.19527, 4.19527 )
z_index = -1

15
Music and Sounds/astervoid-theme.ogg.import

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

15
Music and Sounds/explosion.ogg.import

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

15
Music and Sounds/menu.ogg.import

@ -0,0 +1,15 @@
[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

15
Music and Sounds/rocket-launch.ogg.import

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/rocket-launch.ogg-8d561e573504190ba6fe4ff074c316cf.oggstr"
[deps]
source_file="res://Music and Sounds/rocket-launch.ogg"
dest_files=[ "res://.import/rocket-launch.ogg-8d561e573504190ba6fe4ff074c316cf.oggstr" ]
[params]
loop=false
loop_offset=0

2
Objects/Rocket.tscn

@ -515,5 +515,5 @@ position = Vector2( 0, 47.5 )
rotation = 1.5708
frames = SubResource( 122 )
animation = "New Anim"
frame = 6
frame = 33
playing = true

4
Scripts/CoinLabel.gd

@ -1,6 +1,6 @@
extends Label
onready var gameNode = get_node("/root/Game")
onready var Game = get_node("/root/Game")
func _process(delta):
text = str(gameNode.numOfCoins)
text = str(Game.numOfCoins)

19
Scripts/MenuCoinLabel.gd

@ -0,0 +1,19 @@
extends Label
var hiscore
var numOfCoins
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"]
numOfCoins = data["numOfCoins"]
func _ready():
load_game()
text = str(numOfCoins)

8
Scripts/Rocket.gd

@ -9,12 +9,18 @@ var isScreenPressed = false
var screenPressLocation = get_viewport().get_rect().size/2
onready var gameNode = get_node("/root/Game")
func _ready():
$"Launch".stream.loop = false
$Launch.play()
func _process(delta):
difficulty = 600 + deltaDifficulty
difficulty += 0.0005
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
if score > gameNode.hiscore:
gameNode.hiscore = score
@ -27,7 +33,7 @@ func _process(delta):
get_node("Collider").queue_free()
yield(get_tree().create_timer(1.5), "timeout")
queue_free()
get_tree().change_scene("res://Game Scenes/MainMenu.tscn")
get_tree().change_scene("res://Game Scenes/Main Menu.tscn")
if isScreenPressed:
print (true);
if (screenPressLocation <= get_viewport_rect().size.x/2):

2
Scripts/Text Container.gd

@ -4,7 +4,7 @@ var time = 0
func _process(delta):
time += delta
rotation = sin(time)/10
rotation = sin(2*time)/10
func _input(event):
if event is InputEventScreenTouch:

6
export_presets.cfg

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

2
project.godot

@ -17,7 +17,7 @@ _global_script_class_icons={
config/name="SpacEscape"
config/description="Simple game based on avoiding asteroids while controlling a rocket."
run/main_scene="res://Game Scenes/MainMenu.tscn"
run/main_scene="res://Game Scenes/Main Menu.tscn"
boot_splash/image="res://Images and Anims/Other/logo.png"
config/icon="res://Images and Anims/Other/icon.png"

Loading…
Cancel
Save