Browse Source

Add background

Added a background with a parallax effect and modified existing objects
to contrast with the background
master
Abheek Dhawan 4 years ago
parent
commit
87eebda018
  1. 13
      Game Scenes/Game.tscn
  2. BIN
      Images and Anims/In Game/asteroid.png
  3. BIN
      Images and Anims/In Game/background.png
  4. 34
      Images and Anims/In Game/background.png.import
  5. BIN
      Images and Anims/In Game/rocket-old.png
  6. 34
      Images and Anims/In Game/rocket-old.png.import
  7. BIN
      Images and Anims/In Game/rocket.png
  8. 2
      Scripts/AsteroidSpawn.gd

13
Game Scenes/Game.tscn

@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://Objects/Rocket.tscn" type="PackedScene" id=1] [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://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/AsteroidSpawn.gd" type="Script" id=4] [ext_resource path="res://Scripts/AsteroidSpawn.gd" type="Script" id=4]
[node name="Game" type="Node2D"] [node name="Game" type="Node2D"]
@ -16,3 +17,13 @@ script = ExtResource( 2 )
offset = Vector2( 0, -220 ) offset = Vector2( 0, -220 )
current = true current = true
smoothing_enabled = true smoothing_enabled = true
[node name="ParallaxBackground" type="ParallaxBackground" parent="."]
[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"]
motion_scale = Vector2( 0.01, 0.01 )
[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"]
position = Vector2( 89.4544, -100.794 )
scale = Vector2( 5, 5 )
texture = ExtResource( 3 )

BIN
Images and Anims/In Game/asteroid.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 539 B

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
Images and Anims/In Game/background.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

34
Images and Anims/In Game/rocket-old.png.import

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 10 KiB

2
Scripts/AsteroidSpawn.gd

@ -7,8 +7,6 @@ var deltaSpawnTime = 1
func _process(delta): func _process(delta):
spawnTime = 500/get_viewport_rect().size.x * deltaSpawnTime spawnTime = 500/get_viewport_rect().size.x * deltaSpawnTime
print(spawnTime)
print(get_viewport_rect().size.x)
time += delta time += delta
if time > spawnTime: if time > spawnTime:
time = 0 time = 0

Loading…
Cancel
Save