Skip to content

Commit

Permalink
Merge pull request #1 from Halfwhit/development
Browse files Browse the repository at this point in the history
Simple splash, menu and test level
  • Loading branch information
Halfwhit authored Mar 19, 2019
2 parents 37cb006 + d2f435f commit 97faef1
Show file tree
Hide file tree
Showing 25 changed files with 451 additions and 0 deletions.
Binary file added Fonts/Roboto-Regular.ttf
Binary file not shown.
9 changes: 9 additions & 0 deletions Fonts/title.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]

[sub_resource type="DynamicFontData" id=1]
font_path = "res://Fonts/Roboto-Regular.ttf"

[resource]
size = 128
font_data = SubResource( 1 )

Binary file added Resources/ball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Resources/ball.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/ball.png-0c3280ad08e14f6566aaeef4d0612e1c.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Resources/ball.png"
dest_files=[ "res://.import/ball.png-0c3280ad08e14f6566aaeef4d0612e1c.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=false
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
Binary file added Resources/grass.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Resources/grass.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/grass.png-ea8eb11baefddc112f9bb25c7c5bb84f.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Resources/grass.png"
dest_files=[ "res://.import/grass.png-ea8eb11baefddc112f9bb25c7c5bb84f.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=false
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
Binary file added Resources/hole.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Resources/hole.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/hole.png-cf640f704a6730cffbc50c5cbbf4e023.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Resources/hole.png"
dest_files=[ "res://.import/hole.png-cf640f704a6730cffbc50c5cbbf4e023.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=false
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
47 changes: 47 additions & 0 deletions Resources/tileset.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[gd_resource type="TileSet" load_steps=5 format=2]

[ext_resource path="res://Resources/grass.png" type="Texture" id=1]
[ext_resource path="res://Resources/wall.png" type="Texture" id=2]
[ext_resource path="res://Resources/hole.png" type="Texture" id=3]

[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 50, 0, 50, 50, 0, 50 )

[resource]
0/name = "Grass"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 50, 50 )
0/tile_mode = 0
0/occluder_offset = Vector2( 0, 0 )
0/navigation_offset = Vector2( 0, 0 )
0/shapes = [ ]
0/z_index = 0
1/name = "Wall"
1/texture = ExtResource( 2 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 0, 0, 50, 50 )
1/tile_mode = 0
1/occluder_offset = Vector2( 0, 0 )
1/navigation_offset = Vector2( 0, 0 )
1/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
1/z_index = 0
2/name = "Hole"
2/texture = ExtResource( 3 )
2/tex_offset = Vector2( 0, 0 )
2/modulate = Color( 1, 1, 1, 1 )
2/region = Rect2( 0, 0, 50, 50 )
2/tile_mode = 0
2/occluder_offset = Vector2( 0, 0 )
2/navigation_offset = Vector2( 0, 0 )
2/shapes = [ ]
2/z_index = 0

27 changes: 27 additions & 0 deletions Resources/tileset_edit.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://Resources/grass.png" type="Texture" id=1]
[ext_resource path="res://Resources/wall.png" type="Texture" id=2]
[ext_resource path="res://Resources/hole.png" type="Texture" id=3]

[node name="Node2D" type="Node2D"]

[node name="Grass" type="Sprite" parent="."]
texture = ExtResource( 1 )
centered = false

[node name="Wall" type="Sprite" parent="."]
position = Vector2( 50, 0 )
texture = ExtResource( 2 )
centered = false

[node name="StaticBody2D" type="StaticBody2D" parent="Wall"]

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Wall/StaticBody2D"]
polygon = PoolVector2Array( 0, 0, 50, 0, 50, 50, 0, 50 )

[node name="Hole" type="Sprite" parent="."]
position = Vector2( 100, 0 )
texture = ExtResource( 3 )
centered = false

Binary file added Resources/wall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions Resources/wall.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/wall.png-5fd3e28897256be5a67ec1f6c35e5f75.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Resources/wall.png"
dest_files=[ "res://.import/wall.png-5fd3e28897256be5a67ec1f6c35e5f75.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=false
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
11 changes: 11 additions & 0 deletions Scenes/Assets/Hole.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]

[sub_resource type="CircleShape2D" id=1]
radius = 7.07107

[node name="Hole" type="Area2D"]

[node name="Area" type="CollisionShape2D" parent="."]
position = Vector2( 25, 25 )
shape = SubResource( 1 )

42 changes: 42 additions & 0 deletions Scenes/Assets/Player.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
extends KinematicBody2D

var max_force = 500
var ball_vector = Vector2()
var collision
var in_motion
var friction = 0.98

func _draw():
if in_motion == false:
draw_line(Vector2(), get_local_mouse_position().clamped(max_force/2), Color(0.0, 0.0, 0.0), 1.0, false)

func _process(delta):
update()

func _physics_process(delta):
#Update in_motion variable
check_motion()

if in_motion == false and Input.is_action_just_pressed("touch_main"):
get_new_vector()

hit_ball(delta)

#Apply friction
ball_vector = ball_vector.linear_interpolate(Vector2(0,0), friction * delta)

func get_new_vector():
ball_vector = -get_local_mouse_position().clamped(max_force)

func check_motion():
if ball_vector.length() < 1:
ball_vector = Vector2()
in_motion = false
else:
in_motion = true

func hit_ball(delta):
collision = move_and_collide(ball_vector * delta)
if collision:
ball_vector = ball_vector.bounce(collision.normal)
move_and_collide(ball_vector * delta)
19 changes: 19 additions & 0 deletions Scenes/Assets/Player.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://Scenes/Assets/Player.gd" type="Script" id=1]
[ext_resource path="res://Resources/ball.png" type="Texture" id=2]

[sub_resource type="CircleShape2D" id=1]
custom_solver_bias = 1.0
radius = 25.0

[node name="Player" type="KinematicBody2D"]
scale = Vector2( 0.5, 0.5 )
script = ExtResource( 1 )

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 2 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )

7 changes: 7 additions & 0 deletions Scenes/GUI/Menu.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends Control

var TestLevel = preload("res://Scenes/Levels/TestLevel.tscn")

func _on_Test_pressed():
#warning-ignore:return_value_discarded
get_tree().change_scene_to(TestLevel)
35 changes: 35 additions & 0 deletions Scenes/GUI/Menu.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://Scenes/GUI/Menu.gd" type="Script" id=1]
[ext_resource path="res://Fonts/title.tres" type="DynamicFont" id=2]

[sub_resource type="DynamicFontData" id=1]
font_path = "res://Fonts/Roboto-Regular.ttf"

[sub_resource type="DynamicFont" id=2]
size = 24
font_data = SubResource( 1 )

[node name="Menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )

[node name="Title" type="Label" parent="."]
margin_right = 1024.0
margin_bottom = 600.0
custom_fonts/font = ExtResource( 2 )
text = "Gulf
"
align = 1
valign = 1

[node name="Test" type="Button" parent="."]
margin_left = 410.0
margin_top = 340.0
margin_right = 615.0
margin_bottom = 400.0
custom_fonts/font = SubResource( 2 )
text = "Test Level"

[connection signal="pressed" from="Test" to="." method="_on_Test_pressed"]
19 changes: 19 additions & 0 deletions Scenes/GUI/Splash.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
extends Control

var Menu = preload("res://Scenes/GUI/Menu.tscn")

func _input(event):

#Skip splash screen on mouse click
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
get_node("Splash").hide()

func _on_Timer_timeout():
get_node("Splash").hide()


func _on_Splash_hide():
#Show menu when splash disappears
var menuScene = Menu.instance()
add_child(menuScene)
26 changes: 26 additions & 0 deletions Scenes/GUI/Splash.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://Scenes/GUI/Splash.gd" type="Script" id=1]
[ext_resource path="res://Fonts/title.tres" type="DynamicFont" id=2]


[node name="Splash" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )

[node name="Splash" type="Label" parent="."]
margin_right = 1024.0
margin_bottom = 600.0
custom_fonts/font = ExtResource( 2 )
text = "Gulf"
align = 1
valign = 1

[node name="Timer" type="Timer" parent="."]
wait_time = 5.0
one_shot = true
autostart = true

[connection signal="hide" from="Splash" to="." method="_on_Splash_hide"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
Loading

0 comments on commit 97faef1

Please sign in to comment.