Browse Source

Fix all missing parts of the program

- Fix the bug where you could just go left and avoid all the
asteroids.

- Allow basic computer controls (extremely janky, for testing purposes
  only)
master
Abheek Dhawan 3 years ago
parent
commit
0858b78fba
  1. 4
      Game Scenes/Game.tscn
  2. 2
      Game Scenes/Main Menu.tscn
  3. BIN
      Music and Sounds/rocket-launch.mp3
  4. 15
      Music and Sounds/rocket-launch.mp3.import
  5. 4
      Music and Sounds/rocket-launch.ogg.import
  6. 2
      Objects/Rocket.tscn
  7. 3
      Scripts/Game.gd
  8. 23
      Scripts/Rocket.gd
  9. 3
      Scripts/Text Container.gd
  10. 2
      export_presets.cfg

4
Game Scenes/Game.tscn

@ -9,7 +9,7 @@
[ext_resource path="res://Images and Anims/In Game/coin.png" type="Texture" id=7] [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/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/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://Music and Sounds/rocket-launch.mp3" type="AudioStream" id=10]
[ext_resource path="res://Images and Anims/In Game/playbutton.png" type="Texture" id=11] [ext_resource path="res://Images and Anims/In Game/playbutton.png" type="Texture" id=11]
[sub_resource type="AtlasTexture" id=1] [sub_resource type="AtlasTexture" id=1]
@ -83,7 +83,7 @@ __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 = 4 frame = 3
playing = true playing = true
[node name="Theme Music" type="AudioStreamPlayer" parent="Rocket"] [node name="Theme Music" type="AudioStreamPlayer" parent="Rocket"]

2
Game Scenes/Main Menu.tscn

@ -131,7 +131,7 @@ position = Vector2( 0, -576 )
scale = Vector2( 3, 3 ) scale = Vector2( 3, 3 )
frames = SubResource( 8 ) frames = SubResource( 8 )
animation = "spin" animation = "spin"
frame = 3 frame = 1
playing = true playing = true
[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/Coin"] [node name="Label" type="Label" parent="HBoxContainer/VBoxContainer/CenterContainer/Coin"]

BIN
Music and Sounds/rocket-launch.mp3

Binary file not shown.

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

@ -0,0 +1,15 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
path="res://.import/rocket-launch.mp3-d1781197b8b9e95b3d22056875d3a74c.mp3str"
[deps]
source_file="res://Music and Sounds/rocket-launch.mp3"
dest_files=[ "res://.import/rocket-launch.mp3-d1781197b8b9e95b3d22056875d3a74c.mp3str" ]
[params]
loop=true
loop_offset=0

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

@ -2,13 +2,11 @@
importer="ogg_vorbis" importer="ogg_vorbis"
type="AudioStreamOGGVorbis" type="AudioStreamOGGVorbis"
path="res://.import/rocket-launch.ogg-8d561e573504190ba6fe4ff074c316cf.oggstr" valid=false
[deps] [deps]
source_file="res://Music and Sounds/rocket-launch.ogg" source_file="res://Music and Sounds/rocket-launch.ogg"
dest_files=[ "res://.import/rocket-launch.ogg-8d561e573504190ba6fe4ff074c316cf.oggstr" ]
[params] [params]
loop=false loop=false

2
Objects/Rocket.tscn

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

3
Scripts/Game.gd

@ -45,7 +45,8 @@ func _process(delta):
var spawnx = rand_range($Rocket.position.x - get_viewport_rect().size.x, $Rocket.position.x + get_viewport_rect().size.x) var spawnx = rand_range($Rocket.position.x - get_viewport_rect().size.x, $Rocket.position.x + get_viewport_rect().size.x)
asteroid.position.x = spawnx asteroid.position.x = spawnx
if (spawnx < $Rocket.position.x - get_viewport_rect().size.x/2 or spawnx > $Rocket.position.x + get_viewport_rect().size.x/2): if (spawnx < $Rocket.position.x - get_viewport_rect().size.x/2 or spawnx > $Rocket.position.x + get_viewport_rect().size.x/2):
asteroid.position.y = rand_range($Rocket.position.y + get_viewport_rect().size.y/2, $Rocket.position.y - 2 * get_viewport_rect().size.y) asteroid.position.y = rand_range($Rocket.position.y + get_viewport_rect().size.y / 10, $Rocket.position.y - get_viewport_rect().size.y)
print("Asteroid position outside of viewport: ", asteroid.position.x - $Rocket.position.x, ", ", asteroid.position.y - $Rocket.position.y)
else: else:
asteroid.position.y = rand_range($Rocket.position.y - get_viewport_rect().size.y, $Rocket.position.y - 2 * get_viewport_rect().size.y) asteroid.position.y = rand_range($Rocket.position.y - get_viewport_rect().size.y, $Rocket.position.y - 2 * get_viewport_rect().size.y)
#asteroid.position.x = rand_range($Rocket.position.x - get_viewport_rect().size.x/2, $Rocket.position.x + get_viewport_rect().size.x/2) #asteroid.position.x = rand_range($Rocket.position.x - get_viewport_rect().size.x/2, $Rocket.position.x + get_viewport_rect().size.x/2)

23
Scripts/Rocket.gd

@ -6,7 +6,7 @@ var deltaDifficulty = 0
var explosionObj = load("res://Objects/Explosion.tscn") var explosionObj = load("res://Objects/Explosion.tscn")
var collided = false var collided = false
var isScreenPressed = false var isScreenPressed = false
var screenPressLocation = get_viewport().get_rect().size/2 onready var screenPressLocation = get_viewport().size/2
var lastscore var lastscore
onready var gameNode = get_node("/root/Game") onready var gameNode = get_node("/root/Game")
@ -36,19 +36,25 @@ func _process(delta):
queue_free() queue_free()
get_tree().change_scene("res://Game Scenes/Main Menu.tscn") get_tree().change_scene("res://Game Scenes/Main Menu.tscn")
if isScreenPressed: if isScreenPressed:
print (true); print (true)
if (screenPressLocation <= get_viewport_rect().size.x/2): if (screenPressLocation <= get_viewport_rect().size.x/2):
if angle > -1.5: if angle > -1.5:
rotate(-0.05) turn_left(0.05)
angle -= 0.05
elif (screenPressLocation > get_viewport_rect().size.x/2): elif (screenPressLocation > get_viewport_rect().size.x/2):
if angle < 1.5: if angle < 1.5:
rotate(0.05) turn_right(0.05)
angle += 0.05
else: else:
rotate(-angle/25) rotate(-angle/25)
angle -= angle/25 angle -= angle/25
func turn_right(multiplier):
rotate(multiplier)
angle += multiplier
func turn_left(multiplier):
rotate(multiplier * -1)
angle -= multiplier
func _input(event): func _input(event):
if event is InputEventScreenTouch: if event is InputEventScreenTouch:
if event.pressed == true: if event.pressed == true:
@ -56,3 +62,8 @@ func _input(event):
screenPressLocation = event.position.x screenPressLocation = event.position.x
if event.pressed == false: if event.pressed == false:
isScreenPressed = false isScreenPressed = false
elif event is InputEventKey:
if event.pressed and event.scancode == KEY_LEFT:
turn_left(0.5)
elif event.pressed and event.scancode == KEY_RIGHT:
turn_right(0.5)

3
Scripts/Text Container.gd

@ -10,3 +10,6 @@ func _input(event):
if event is InputEventScreenTouch: if event is InputEventScreenTouch:
if event.pressed == true: if event.pressed == true:
get_tree().change_scene("res://Game Scenes/Game.tscn") get_tree().change_scene("res://Game Scenes/Game.tscn")
elif event is InputEventKey:
if event.pressed and event.scancode == KEY_SPACE:
get_tree().change_scene("res://Game Scenes/Game.tscn")

2
export_presets.cfg

@ -179,7 +179,7 @@ application/info="Made with Godot Engine"
application/identifier="com.ADAwesomeGames.AsterVoid" application/identifier="com.ADAwesomeGames.AsterVoid"
application/signature="" application/signature=""
application/short_version="2.0" application/short_version="2.0"
application/version="2.9" application/version="2.11"
application/copyright="2021 AD Awesome Games" application/copyright="2021 AD Awesome Games"
capabilities/access_wifi=false capabilities/access_wifi=false
capabilities/push_notifications=false capabilities/push_notifications=false

Loading…
Cancel
Save