Skip to content

Commit

Permalink
part 15
Browse files Browse the repository at this point in the history
  • Loading branch information
cbscribe committed Feb 10, 2019
1 parent 2b549c2 commit 7de9e50
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 24 deletions.
16 changes: 15 additions & 1 deletion globals.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
extends Node

var slow_terrain = [0, 10, 20, 30, 7, 8, 17, 18]
var slow_terrain = [0, 10, 20, 30, 7, 8, 17, 18]
var current_level = 0
var levels = ["res://ui/TitleScreen.tscn", "res://maps/Map01.tscn"]

func restart():
current_level = 0
get_tree().change_scene(levels[current_level])

func next_level():
current_level += 1
printt("level", current_level)
if current_level < levels.size():
get_tree().change_scene(levels[current_level])
else:
restart()
2 changes: 1 addition & 1 deletion maps/Map.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ func _on_Tank_shoot(bullet, _position, _direction, _target=null):
b.start(_position, _direction, _target)

func _on_Player_dead():
get_tree().reload_current_scene()
GLOBALS.restart()
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ config_version=3
[application]

config/name="Top-down Tank Battle"
run/main_scene="res://ui/TitleScreen.tscn"
config/icon="res://icon.png"

[autoload]
Expand Down
5 changes: 5 additions & 0 deletions ui/TitleScreen.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
extends Control

func _input(event):
if event.is_action_pressed("ui_select"):
GLOBALS.next_level()
47 changes: 25 additions & 22 deletions ui/TitleScreen.tscn
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
[gd_scene load_steps=9 format=2]
[gd_scene load_steps=10 format=2]

[ext_resource path="res://terrain/terrain_tiles.tres" type="TileSet" id=1]
[ext_resource path="res://assets/Xolonium-Regular.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://tanks/EnemyTank.tscn" type="PackedScene" id=3]
[ext_resource path="res://environment/Obstacle.tscn" type="PackedScene" id=4]
[ext_resource path="res://ui/TitleScreen.gd" type="Script" id=1]
[ext_resource path="res://terrain/terrain_tiles.tres" type="TileSet" id=2]
[ext_resource path="res://assets/Xolonium-Regular.ttf" type="DynamicFontData" id=3]
[ext_resource path="res://tanks/EnemyTank.tscn" type="PackedScene" id=4]
[ext_resource path="res://environment/Obstacle.tscn" type="PackedScene" id=5]

[sub_resource type="DynamicFont" id=1]

size = 96
use_mipmaps = false
use_filter = false
font_data = ExtResource( 2 )
font_data = ExtResource( 3 )
_sections_unfolded = [ "Font", "Settings" ]

[sub_resource type="DynamicFont" id=2]

size = 48
use_mipmaps = false
use_filter = false
font_data = ExtResource( 2 )
font_data = ExtResource( 3 )
_sections_unfolded = [ "Font", "Settings" ]

[sub_resource type="Animation" id=3]
Expand Down Expand Up @@ -71,13 +72,14 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
script = ExtResource( 1 )

[node name="TileMap" type="TileMap" parent="." index="0"]

modulate = Color( 0.761719, 0.761719, 0.761719, 1 )
scale = Vector2( 0.5, 0.5 )
mode = 0
tile_set = ExtResource( 1 )
tile_set = ExtResource( 2 )
cell_size = Vector2( 128, 128 )
cell_quadrant_size = 16
cell_custom_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
Expand All @@ -101,8 +103,8 @@ anchor_left = 0.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_top = -134.0
margin_bottom = -18.0
margin_top = -464.0
margin_bottom = -348.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
Expand All @@ -122,6 +124,7 @@ _sections_unfolded = [ "Rect", "custom_fonts" ]

[node name="PlayMessage" type="Label" parent="." index="2"]

visible = false
anchor_left = 0.0
anchor_top = 1.0
anchor_right = 1.0
Expand Down Expand Up @@ -163,7 +166,7 @@ curve = SubResource( 4 )
[node name="PathFollow2D" type="PathFollow2D" parent="Path2D" index="0"]

position = Vector2( -228.529, 98.8956 )
rotation = -0.00303456
rotation = -0.00303654
scale = Vector2( 0.5, 0.5 )
offset = 0.0
h_offset = 0.0
Expand All @@ -174,65 +177,65 @@ loop = true
lookahead = 4.0
_sections_unfolded = [ "Transform" ]

[node name="EnemyTank" parent="Path2D/PathFollow2D" index="0" instance=ExtResource( 3 )]
[node name="EnemyTank" parent="Path2D/PathFollow2D" index="0" instance=ExtResource( 4 )]

_sections_unfolded = [ "Collision", "Transform", "collision" ]
max_speed = 75

[node name="Obstacle" parent="." index="5" instance=ExtResource( 4 )]
[node name="Obstacle" parent="." index="5" instance=ExtResource( 5 )]

position = Vector2( 156.482, 507.511 )
rotation = -0.967426

[node name="Obstacle2" parent="." index="6" instance=ExtResource( 4 )]
[node name="Obstacle2" parent="." index="6" instance=ExtResource( 5 )]

position = Vector2( 932.551, 414.467 )
rotation = -3.6118
type = 19

[node name="Obstacle7" parent="." index="7" instance=ExtResource( 4 )]
[node name="Obstacle7" parent="." index="7" instance=ExtResource( 5 )]

position = Vector2( 435.613, 593.153 )
rotation = -3.6118
type = 19

[node name="Obstacle6" parent="." index="8" instance=ExtResource( 4 )]
[node name="Obstacle6" parent="." index="8" instance=ExtResource( 5 )]

position = Vector2( 549.803, 559.319 )
rotation = -2.7194
type = 18

[node name="Obstacle5" parent="." index="9" instance=ExtResource( 4 )]
[node name="Obstacle5" parent="." index="9" instance=ExtResource( 5 )]

position = Vector2( 1001.28, 383.805 )
rotation = -3.6118
type = 19

[node name="Obstacle4" parent="." index="10" instance=ExtResource( 4 )]
[node name="Obstacle4" parent="." index="10" instance=ExtResource( 5 )]

position = Vector2( 939.952, 329.882 )
rotation = -2.80657
type = 19

[node name="Obstacle3" parent="." index="11" instance=ExtResource( 4 )]
[node name="Obstacle3" parent="." index="11" instance=ExtResource( 5 )]

position = Vector2( 949.468, 107.846 )
rotation = -2.80657
type = 9

[node name="Obstacle8" parent="." index="12" instance=ExtResource( 4 )]
[node name="Obstacle8" parent="." index="12" instance=ExtResource( 5 )]

position = Vector2( 79.9405, 190.386 )
rotation = -1.56665
type = 6

[node name="Obstacle9" parent="." index="13" instance=ExtResource( 4 )]
[node name="Obstacle9" parent="." index="13" instance=ExtResource( 5 )]

position = Vector2( 29.6049, 163.884 )
rotation = -1.84714
type = 7

[node name="Obstacle10" parent="." index="14" instance=ExtResource( 4 )]
[node name="Obstacle10" parent="." index="14" instance=ExtResource( 5 )]

position = Vector2( 29.0277, 213.416 )
rotation = -1.84714
Expand Down

0 comments on commit 7de9e50

Please sign in to comment.