diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0f8f149 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Set the default behavior, in case people don't have core.autocrlf set. +* text=auto + +# Explicitly declare text files you want to always be normalized and converted +# to native line endings on checkout. +*.cpp text +*.c text +*.h text +*.gd text +*.cs text + +# Declare files that will always have CRLF line endings on checkout. +*.sln text eol=crlf + +# Denote all files that are truly binary and should not be modified. +*.png binary +*.jpg binary diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..21f18b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Godot-specific ignores +.import/ +export.cfg +export_presets.cfg + +# Imported translations (automatically generated from CSV files) +*.translation + +# Mono-specific ignores +.mono/ +data_*/ + +# Godot git plugin +addons/godot-git-plugin/ + +# Exported binary +export/ diff --git a/Game.gd b/Game.gd new file mode 100644 index 0000000..76940d8 --- /dev/null +++ b/Game.gd @@ -0,0 +1,98 @@ +extends Node + +export(PackedScene) var obstacle1_scene +export(PackedScene) var obstacle2_scene + +onready var player = get_node("Player") + +const gravity:float = 6.0 +const power:float = 6.0 +const vx:float = 200.0 +const max_vy:float = 200.0 +const min_vy:float = - 200.0 +const sensitivity:float = 1.5 + +var score:int = 0 +var vy:float = 0 + + +func _ready(): + randomize() + $MessageLabel.text = "READY" + $MessageLabel.show() + $SceneTimer.wait_time = 1 + $SceneTimer.start() + $ScoreTimer.connect("timeout", self, "_on_ScoreTimer_timeout") + $ScoreLabel.hide() + player.position = Vector2(360, 540) + + +func _process(delta): + if Global.playing: + if Input.is_action_pressed("move"): + # Accelerate upwards + if (vy > min_vy): + vy -= min(1, sensitivity * (vy - min_vy) / (-min_vy)) * power + else: + # Accelerate downwards + if (vy < max_vy): + vy += min(1, sensitivity * (max_vy - vy) / max_vy) * gravity + + player.rotation = atan2(vy, vx) + + player.position.y += vy * delta + + +func _on_SceneTimer_timeout(): + if $MessageLabel.text == "READY": + $MessageLabel.text = "GO!" + $SceneTimer.wait_time = 0.5 + $SceneTimer.start() + elif $MessageLabel.text == "GO!": + $MessageLabel.text = "" + $MessageLabel.hide() + Global.playing = true + $ScoreTimer.start() + $ScoreLabel.text = "Score: %d" % score + $ScoreLabel.show() + $ObstacleTimer.start() + else: + # Game over + get_tree().change_scene("res://Title.tscn") + + +func _on_ScoreTimer_timeout(): + score += 1 + $ScoreLabel.text = "Score: %d" % score + + +func _on_ObstacleTimer_timeout(): + $ObstacleTimer.wait_time = rand_range(1.4 - Global.difficulty * 0.2, 5.0 - Global.difficulty) + $ObstacleTimer.start() + + var obstacle = obstacle1_scene.instance() + + var spawn_location = get_node("ObstaclePath/ObstacleSpawnLocation") + spawn_location.offset = randi() + + var direction = atan3(player.position - spawn_location.position) + rand_range(-PI / 8, PI / 8) + + obstacle.position = spawn_location.position + obstacle.rotation = direction + PI + + var velocity = Vector2(rand_range(240, 500), 0) + obstacle.linear_velocity = velocity.rotated(direction) + + add_child(obstacle) + + +func game_over(): + Global.playing = false + $ScoreTimer.stop() + $ObstacleTimer.stop() + $SceneTimer.wait_time = 3 + $SceneTimer.start() + + +func atan3(v:Vector2): + return atan2(v.y, v.x) diff --git a/Game.tscn b/Game.tscn new file mode 100644 index 0000000..80f8aa5 --- /dev/null +++ b/Game.tscn @@ -0,0 +1,95 @@ +[gd_scene load_steps=9 format=2] + +[ext_resource path="res://fonts/Roboto-Regular.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://Game.gd" type="Script" id=2] +[ext_resource path="res://sprites/Player.tscn" type="PackedScene" id=3] +[ext_resource path="res://sprites/Obstacle1.tscn" type="PackedScene" id=4] +[ext_resource path="res://sprites/Obstacle2.tscn" type="PackedScene" id=5] + +[sub_resource type="DynamicFont" id=3] +size = 120 +use_mipmaps = true +use_filter = true +font_data = ExtResource( 1 ) + +[sub_resource type="DynamicFont" id=1] +size = 96 +outline_size = 1 +use_filter = true +font_data = ExtResource( 1 ) + +[sub_resource type="Curve2D" id=4] +_data = { +"points": PoolVector2Array( 0, 0, 0, 0, 1600, 0, 0, 0, 0, 0, 1920, 0, 0, 0, 0, 0, 1920, 1080, 0, 0, 0, 0, 1600, 1080 ) +} + +[node name="Game1" type="Node"] +script = ExtResource( 2 ) +obstacle1_scene = ExtResource( 4 ) +obstacle2_scene = ExtResource( 5 ) + +[node name="Background" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +__meta__ = { +"_edit_group_": true, +"_edit_lock_": true +} + +[node name="ColorBackground" type="ColorRect" parent="Background"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 1 ) + +[node name="MessageLabel" type="Label" parent="."] +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +margin_top = -100.0 +margin_bottom = 100.0 +custom_fonts/font = SubResource( 3 ) +text = "Ready" +align = 1 +valign = 1 +__meta__ = { +"_edit_lock_": true +} + +[node name="ScoreLabel" type="Label" parent="."] +anchor_left = 1.0 +anchor_right = 1.0 +margin_left = -450.0 +margin_top = 50.0 +margin_right = -50.0 +margin_bottom = 150.0 +custom_fonts/font = SubResource( 1 ) +align = 2 +valign = 1 +__meta__ = { +"_edit_lock_": true +} + +[node name="Player" parent="." instance=ExtResource( 3 )] +position = Vector2( 360, 540 ) +scale = Vector2( 0.7, 0.7 ) +__meta__ = { +"_edit_lock_": true +} + +[node name="SceneTimer" type="Timer" parent="."] +one_shot = true + +[node name="ObstacleTimer" type="Timer" parent="."] +one_shot = true + +[node name="ScoreTimer" type="Timer" parent="."] + +[node name="ObstaclePath" type="Path2D" parent="."] +curve = SubResource( 4 ) + +[node name="ObstacleSpawnLocation" type="PathFollow2D" parent="ObstaclePath"] +position = Vector2( 1600, 0 ) + +[connection signal="hit" from="Player" to="." method="game_over"] +[connection signal="timeout" from="SceneTimer" to="." method="_on_SceneTimer_timeout"] +[connection signal="timeout" from="ObstacleTimer" to="." method="_on_ObstacleTimer_timeout"] diff --git a/GameSelectionRect.gd b/GameSelectionRect.gd new file mode 100644 index 0000000..f5d65d8 --- /dev/null +++ b/GameSelectionRect.gd @@ -0,0 +1,45 @@ +extends ReferenceRect + +signal game_selected(difficulty) + +onready var progress_bar = $GameSelectionProgress +onready var timer = $GameSelectionTimer + +var screen_width = 1920 +var speed:float = 4 +var selection_delay:float = 2 +var progress_id:int = 0 + +func _ready(): + progress_bar.value = 0 + timer.connect("timeout", self, "_on_timer_timeout") + + +func _process(_delta): + if (Input.is_action_pressed("move")): + rect_position.x += speed + if (rect_position.x > screen_width + border_width): + rect_position.x -= screen_width + border_width*2 + rect_size.x + + progress_id = 0 + for i in range(1,4): + if (abs((rect_position.x + rect_size.x/2) - (3*i-1) * 0.1 * screen_width) < border_width + 40): + progress_id = i + break + + if progress_id: + border_color = Color(1, 1, 0, 0.75) + if timer.is_stopped(): + timer.start(selection_delay) + $SelectionSFX.play() + progress_bar.value = 100 * (selection_delay - timer.time_left) / selection_delay + else: + progress_bar.value = 0 + border_color = Color(1, 1, 0, 0.25) + timer.stop() + $SelectionSFX.stop() + + +func _on_timer_timeout(): + # Emit signal to start selected game + emit_signal("game_selected", progress_id) diff --git a/Global.gd b/Global.gd new file mode 100644 index 0000000..579615a --- /dev/null +++ b/Global.gd @@ -0,0 +1,16 @@ +extends Node + +var difficulty:int = 0 +var playing:bool = false + + +func _ready(): + OS.window_fullscreen = false + OS.window_maximized = true + + +func _process(_delta): + if Input.is_action_just_pressed("toggle_fullscreen"): + OS.window_fullscreen = !OS.window_fullscreen + if Input.is_action_just_released("exit_game"): + get_tree().quit() diff --git a/Global.tscn b/Global.tscn new file mode 100644 index 0000000..ae76f0e --- /dev/null +++ b/Global.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Global.gd" type="Script" id=1] + +[node name="Global" type="Node"] +script = ExtResource( 1 ) diff --git a/README.md b/README.md new file mode 100644 index 0000000..82d865a --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Bicycle game + +2022 서울 메이커축제 출품작 diff --git a/Title.gd b/Title.gd new file mode 100644 index 0000000..2e96198 --- /dev/null +++ b/Title.gd @@ -0,0 +1,10 @@ +extends Node + + +func _ready(): + var selectionRect = get_node("GameSelection/GameSelectionRect") + selectionRect.connect("game_selected", self, "_on_game_selected") + +func _on_game_selected(difficulty): + Global.difficulty = difficulty + get_tree().change_scene("res://Game.tscn") diff --git a/Title.tscn b/Title.tscn new file mode 100644 index 0000000..16d504d --- /dev/null +++ b/Title.tscn @@ -0,0 +1,178 @@ +[gd_scene load_steps=9 format=2] + +[ext_resource path="res://fonts/Roboto-Regular.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://GameSelectionRect.gd" type="Script" id=2] +[ext_resource path="res://Title.gd" type="Script" id=3] + +[sub_resource type="DynamicFont" id=1] +size = 120 +use_mipmaps = true +use_filter = true +font_data = ExtResource( 1 ) + +[sub_resource type="ImageTexture" id=2] + +[sub_resource type="DynamicFont" id=3] +size = 56 +use_filter = true +font_data = ExtResource( 1 ) + +[sub_resource type="Gradient" id=4] +offsets = PoolRealArray( 0 ) +colors = PoolColorArray( 1, 1, 0, 0.25098 ) + +[sub_resource type="GradientTexture2D" id=5] +gradient = SubResource( 4 ) +width = 480 +height = 600 + +[node name="Title" type="Node"] +script = ExtResource( 3 ) + +[node name="Background" type="TextureRect" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="ColorBackground" type="ColorRect" parent="Background"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0, 0, 0, 1 ) + +[node name="TitleLabel" type="Label" parent="."] +anchor_top = 0.2 +anchor_right = 1.0 +anchor_bottom = 0.2 +margin_top = -100.0 +margin_bottom = 100.0 +custom_fonts/font = SubResource( 1 ) +text = "Good Luck! :D" +align = 1 +valign = 1 + +[node name="GameSelection" type="Control" parent="."] +anchor_top = 0.6 +anchor_right = 1.0 +anchor_bottom = 0.6 + +[node name="Game1" type="Control" parent="GameSelection"] +anchor_left = 0.2 +anchor_right = 0.2 +margin_left = -200.0 +margin_top = -200.0 +margin_right = 200.0 +margin_bottom = 300.0 +__meta__ = { +"_editor_description_": "" +} + +[node name="TextureRect" type="TextureRect" parent="GameSelection/Game1"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_bottom = -100.0 +texture = SubResource( 2 ) + +[node name="ColorRect" type="ColorRect" parent="GameSelection/Game1/TextureRect"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.486275, 0.733333, 0.262745, 1 ) + +[node name="Title2" type="Label" parent="GameSelection/Game1"] +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_top = -100.0 +custom_fonts/font = SubResource( 3 ) +text = "Easy" +align = 1 +valign = 1 + +[node name="Game2" type="Control" parent="GameSelection"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -200.0 +margin_top = -200.0 +margin_right = 200.0 +margin_bottom = 300.0 +__meta__ = { +"_editor_description_": "" +} + +[node name="TextureRect" type="TextureRect" parent="GameSelection/Game2"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_bottom = -100.0 +texture = SubResource( 2 ) + +[node name="ColorRect" type="ColorRect" parent="GameSelection/Game2/TextureRect"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.835294, 0.709804, 0.219608, 1 ) + +[node name="Title2" type="Label" parent="GameSelection/Game2"] +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_top = -100.0 +custom_fonts/font = SubResource( 3 ) +text = "Normal" +align = 1 +valign = 1 + +[node name="Game3" type="Control" parent="GameSelection"] +anchor_left = 0.8 +anchor_right = 0.8 +margin_left = -200.0 +margin_top = -200.0 +margin_right = 200.0 +margin_bottom = 300.0 +__meta__ = { +"_editor_description_": "" +} + +[node name="TextureRect" type="TextureRect" parent="GameSelection/Game3"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_bottom = -100.0 +texture = SubResource( 2 ) + +[node name="ColorRect" type="ColorRect" parent="GameSelection/Game3/TextureRect"] +anchor_right = 1.0 +anchor_bottom = 1.0 +color = Color( 0.707031, 0.199111, 0.115997, 1 ) + +[node name="Title2" type="Label" parent="GameSelection/Game3"] +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_top = -100.0 +custom_fonts/font = SubResource( 3 ) +text = "Hard" +align = 1 +valign = 1 + +[node name="GameSelectionRect" type="ReferenceRect" parent="GameSelection"] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -1450.0 +margin_top = -240.0 +margin_right = -970.0 +margin_bottom = 360.0 +border_color = Color( 1, 1, 0, 0.25098 ) +border_width = 10.0 +editor_only = false +script = ExtResource( 2 ) + +[node name="GameSelectionTimer" type="Timer" parent="GameSelection/GameSelectionRect"] +wait_time = 3.0 +one_shot = true + +[node name="GameSelectionProgress" type="TextureProgress" parent="GameSelection/GameSelectionRect"] +anchor_right = 1.0 +anchor_bottom = 1.0 +texture_progress = SubResource( 5 ) +fill_mode = 3 + +[node name="SelectionSFX" type="AudioStreamPlayer" parent="GameSelection/GameSelectionRect"] + +[node name="BGM" type="AudioStreamPlayer" parent="."] +autoplay = true diff --git a/assets/Obstacle1.png b/assets/Obstacle1.png new file mode 100644 index 0000000..f93359e Binary files /dev/null and b/assets/Obstacle1.png differ diff --git a/assets/Obstacle1.png.import b/assets/Obstacle1.png.import new file mode 100644 index 0000000..b5dce1d --- /dev/null +++ b/assets/Obstacle1.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Obstacle1.png-e5d007ec1cf2838df26008a4403c46bc.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Obstacle1.png" +dest_files=[ "res://.import/Obstacle1.png-e5d007ec1cf2838df26008a4403c46bc.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/Obstacle2.png b/assets/Obstacle2.png new file mode 100644 index 0000000..3497546 Binary files /dev/null and b/assets/Obstacle2.png differ diff --git a/assets/Obstacle2.png.import b/assets/Obstacle2.png.import new file mode 100644 index 0000000..70e0744 --- /dev/null +++ b/assets/Obstacle2.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/Obstacle2.png-15a8d0098ffe923165f6e39166aa3c86.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/Obstacle2.png" +dest_files=[ "res://.import/Obstacle2.png-15a8d0098ffe923165f6e39166aa3c86.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/assets/crash.mp3 b/assets/crash.mp3 new file mode 100644 index 0000000..9fec651 Binary files /dev/null and b/assets/crash.mp3 differ diff --git a/assets/crash.mp3.import b/assets/crash.mp3.import new file mode 100644 index 0000000..99d2fe1 --- /dev/null +++ b/assets/crash.mp3.import @@ -0,0 +1,15 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +path="res://.import/crash.mp3-90001c3f1ebe14c4180d65ac3af8543d.mp3str" + +[deps] + +source_file="res://assets/crash.mp3" +dest_files=[ "res://.import/crash.mp3-90001c3f1ebe14c4180d65ac3af8543d.mp3str" ] + +[params] + +loop=true +loop_offset=0 diff --git a/assets/flying.mp3 b/assets/flying.mp3 new file mode 100644 index 0000000..0e3dd90 Binary files /dev/null and b/assets/flying.mp3 differ diff --git a/assets/flying.mp3.import b/assets/flying.mp3.import new file mode 100644 index 0000000..b723361 --- /dev/null +++ b/assets/flying.mp3.import @@ -0,0 +1,15 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +path="res://.import/flying.mp3-30f47889507ea89b84437a18d7b855f7.mp3str" + +[deps] + +source_file="res://assets/flying.mp3" +dest_files=[ "res://.import/flying.mp3-30f47889507ea89b84437a18d7b855f7.mp3str" ] + +[params] + +loop=true +loop_offset=0 diff --git a/assets/plane.png b/assets/plane.png new file mode 100644 index 0000000..9df1aaa Binary files /dev/null and b/assets/plane.png differ diff --git a/assets/plane.png.import b/assets/plane.png.import new file mode 100644 index 0000000..8a389f2 --- /dev/null +++ b/assets/plane.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/plane.png-33879e5de9b30785d06ff27a3ae341ea.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/plane.png" +dest_files=[ "res://.import/plane.png-33879e5de9b30785d06ff27a3ae341ea.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 +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/default_env.tres b/default_env.tres new file mode 100644 index 0000000..20207a4 --- /dev/null +++ b/default_env.tres @@ -0,0 +1,7 @@ +[gd_resource type="Environment" load_steps=2 format=2] + +[sub_resource type="ProceduralSky" id=1] + +[resource] +background_mode = 2 +background_sky = SubResource( 1 ) diff --git a/fonts/LICENSE.txt b/fonts/LICENSE.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/fonts/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/fonts/Roboto-Regular.ttf b/fonts/Roboto-Regular.ttf new file mode 100644 index 0000000..ddf4bfa Binary files /dev/null and b/fonts/Roboto-Regular.ttf differ diff --git a/project.godot b/project.godot new file mode 100644 index 0000000..eaed61b --- /dev/null +++ b/project.godot @@ -0,0 +1,70 @@ +; Engine configuration file. +; It's best edited using the editor UI and not directly, +; since the parameters that go here are not all obvious. +; +; Format: +; [section] ; section goes between [] +; param=value ; assign values to parameters + +config_version=4 + +_global_script_classes=[ { +"base": "", +"class": "GitAPI", +"language": "NativeScript", +"path": "res://addons/godot-git-plugin/git_api.gdns" +} ] +_global_script_class_icons={ +"GitAPI": "" +} + +[application] + +config/name="Bicycle game" +run/main_scene="res://Title.tscn" + +[autoload] + +Global="*res://Global.tscn" + +[display] + +window/size/width=1920 +window/size/height=1080 +window/stretch/mode="2d" +window/stretch/aspect="keep" + +[editor] + +version_control_autoload_on_startup=true +version_control_plugin_name="GitAPI" + +[gui] + +common/drop_mouse_on_gui_input_disabled=true + +[input] + +move={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +toggle_fullscreen={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":70,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} +exit_game={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777217,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} + +[physics] + +common/enable_pause_aware_picking=true + +[rendering] + +environment/default_environment="res://default_env.tres" diff --git a/sprites/Obstacle1.gd b/sprites/Obstacle1.gd new file mode 100644 index 0000000..ebb7ce6 --- /dev/null +++ b/sprites/Obstacle1.gd @@ -0,0 +1,7 @@ +extends RigidBody2D + +func _ready(): + pass + +func _on_VisibilityNotifier2D_screen_exited(): + queue_free() diff --git a/sprites/Obstacle1.tscn b/sprites/Obstacle1.tscn new file mode 100644 index 0000000..7150fde --- /dev/null +++ b/sprites/Obstacle1.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://assets/Obstacle1.png" type="Texture" id=1] +[ext_resource path="res://sprites/Obstacle1.gd" type="Script" id=2] + +[sub_resource type="CircleShape2D" id=1] +radius = 65.0077 + +[node name="Obstacle1" type="RigidBody2D"] +gravity_scale = 0.0 +script = ExtResource( 2 ) + +[node name="Obstacle1" type="Sprite" parent="."] +rotation = 0.436332 +texture = ExtResource( 1 ) +offset = Vector2( 48, -15 ) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +shape = SubResource( 1 ) + +[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] +position = Vector2( 53, 3.99999 ) +scale = Vector2( 12.05, 7.4 ) diff --git a/sprites/Obstacle2.gd b/sprites/Obstacle2.gd new file mode 100644 index 0000000..4e0ce43 --- /dev/null +++ b/sprites/Obstacle2.gd @@ -0,0 +1,7 @@ +extends RigidBody2D + +func _ready(): + pass + +func _on_VisibilityNotifier2D_screen_exited(): + queue_free() diff --git a/sprites/Obstacle2.tscn b/sprites/Obstacle2.tscn new file mode 100644 index 0000000..80b79b9 --- /dev/null +++ b/sprites/Obstacle2.tscn @@ -0,0 +1,20 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/Obstacle2.png" type="Texture" id=1] +[ext_resource path="res://sprites/Obstacle2.gd" type="Script" id=2] + +[node name="Obstacle2" type="RigidBody2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +rotation = 0.296706 +scale = Vector2( 1, 1 ) +texture = ExtResource( 1 ) +offset = Vector2( 70, -50 ) + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PoolVector2Array( -203, -9, -150, -55, -24, -62, 57, -74, 165, -16, 131, 91, 31, 107, -52, 76, -183, 37 ) + +[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."] +position = Vector2( 60.5, 13.5 ) +scale = Vector2( 26.75, 9.65 ) diff --git a/sprites/Player.gd b/sprites/Player.gd new file mode 100644 index 0000000..e45edea --- /dev/null +++ b/sprites/Player.gd @@ -0,0 +1,24 @@ +extends Area2D + +signal hit + +func _process(delta): + if Global.playing: + if (position.y < 0 or position.y > 1080): + hit() + + +func _on_Player_body_entered(body): + hit() + + +func hit(): + hide() + emit_signal("hit") + $CollisionPolygon2D.set_deferred("disabled", true) + + +func start(pos): + position = pos + show() + $CollisionPolygon2D.disabled = false diff --git a/sprites/Player.tscn b/sprites/Player.tscn new file mode 100644 index 0000000..9e2cbf7 --- /dev/null +++ b/sprites/Player.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/plane.png" type="Texture" id=1] +[ext_resource path="res://sprites/Player.gd" type="Script" id=2] + +[node name="Player" type="Area2D"] +script = ExtResource( 2 ) + +[node name="Sprite" type="Sprite" parent="."] +texture = ExtResource( 1 ) +offset = Vector2( -40, 8 ) +flip_h = true + +[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] +polygon = PoolVector2Array( -48, -144, 25, -37, 153, -42, 199, 15, 31, 32, 2, 159, -55, 175, -34, 29, -221, 33, -221, -89, -179, -22, -35, -34, -100, -161 ) + +[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]