This commit is contained in:
ajuvercr 2020-01-14 22:20:17 +01:00
commit f73c86d4a1
17 changed files with 247 additions and 0 deletions

View file

@ -0,0 +1,3 @@
source_md5="5438542557626c9814ef2162a19e2908"
dest_md5="0ef11008070ef53cd0839c6e85118d97"

View file

@ -0,0 +1,3 @@
source_md5="8dd9ff1eebf38898a54579d8c01b0a88"
dest_md5="da70afec3c66d4e872db67f808e12edb"

Binary file not shown.

View file

@ -0,0 +1,3 @@
source_md5="5438542557626c9814ef2162a19e2908"
dest_md5="0ef11008070ef53cd0839c6e85118d97"

19
Camera2D.gd Normal file
View file

@ -0,0 +1,19 @@
extends Node
onready var screen_size = Vector2(ProjectSettings.get("display/window/size/width"), ProjectSettings.get("display/window/size/height"))
onready var player = get_node("Player")
func update_view():
var canvas_transform = get_viewport().get_canvas_transform()
var pos = player.position
pos.y = 0
canvas_transform[2] = -player.position + screen_size / 2
get_viewport().set_canvas_transform(canvas_transform)
func _ready():
update_view()
func _on_Player_move():
print("moving")
update_view()
pass # Replace with function body.

19
Main.tscn Normal file
View file

@ -0,0 +1,19 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Camera2D.gd" type="Script" id=1]
[ext_resource path="res://icon.png" type="Texture" id=2]
[ext_resource path="res://Player.tscn" type="PackedScene" id=3]
[node name="View" type="Node"]
script = ExtResource( 1 )
[node name="Background" type="TextureRect" parent="."]
margin_top = -320.0
margin_right = 420.0
margin_bottom = 320.0
texture = ExtResource( 2 )
expand = true
[node name="Player" parent="." instance=ExtResource( 3 )]
jump_speed = 10
[connection signal="move" from="Player" to="." method="_on_Player_move"]

31
Player.gd Normal file
View file

@ -0,0 +1,31 @@
extends Area2D
export var speed = 1 # How fast the player will move (pixels/sec).
export var jump_speed = 10
signal move
var screen_size
var speed_y = 0
func start():
position = screen_size / 2
# Called when the node enters the scene tree for the first time.
func _ready():
screen_size = get_viewport_rect().size
func _process(delta):
if Input.is_action_just_pressed("ui_accept"):
print("HERE")
speed_y = min(speed_y, 0) - 1 * jump_speed
speed_y += 1
position.x += 1
position.y += speed_y * speed
emit_signal("move")
# TODO find the correct rotation, noob
rotation = atan(speed_y / speed) + PI / 2

28
Player.tscn Normal file
View file

@ -0,0 +1,28 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[ext_resource path="res://icon.png" type="Texture" id=2]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 2 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[sub_resource type="CapsuleShape2D" id=2]
radius = 12.8837
height = 4.07484
[node name="Player" type="Area2D"]
position = Vector2( 210, 0 )
script = ExtResource( 1 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
scale = Vector2( 0.498334, 0.531778 )
frames = SubResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource( 2 )

7
default_env.tres Normal file
View file

@ -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 )

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

34
icon.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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

32
project.godot Normal file
View file

@ -0,0 +1,32 @@
; 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=[ ]
_global_script_class_icons={
}
[application]
config/name="FlappyBird"
run/main_scene="res://Main.tscn"
config/icon="res://icon.png"
[display]
window/size/width=420
window/size/height=640
[rendering]
quality/driver/driver_name="GLES2"
vram_compression/import_etc=true
vram_compression/import_etc2=false
environment/default_environment="res://default_env.tres"

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/Mobile - Flappy Bird - Version 12 Sprites.png-50665e675b70d6f6b5054e9d15ad7653.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://res/Mobile - Flappy Bird - Version 12 Sprites.png"
dest_files=[ "res://.import/Mobile - Flappy Bird - Version 12 Sprites.png-50665e675b70d6f6b5054e9d15ad7653.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
res/sprites.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

34
res/sprites.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://res/sprites.png"
dest_files=[ "res://.import/sprites.png-7e797c86c60ebf1baad54990ba20f2d3.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