It's Cow Game! Version 2.04!
BIN
MiniGames/FlappyCow/Art/Cloud.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
34
MiniGames/FlappyCow/Art/Cloud.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://caq1psoxctt2d"
|
||||
path="res://.godot/imported/Cloud.png-1e887f77a73f50b4fbe354569392ccd9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/Cloud.png"
|
||||
dest_files=["res://.godot/imported/Cloud.png-1e887f77a73f50b4fbe354569392ccd9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
MiniGames/FlappyCow/Art/Flower.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
34
MiniGames/FlappyCow/Art/Flower.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dmp2iwl8gse4g"
|
||||
path="res://.godot/imported/Flower.png-9ccc7f140686d156dbf50491e44b3bdc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/Flower.png"
|
||||
dest_files=["res://.godot/imported/Flower.png-9ccc7f140686d156dbf50491e44b3bdc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
MiniGames/FlappyCow/Art/TilesetOf5.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
34
MiniGames/FlappyCow/Art/TilesetOf5.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dxtx8htjdu1mh"
|
||||
path="res://.godot/imported/TilesetOf5.png-22b15725aed887164d6213d1fdf4228d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/TilesetOf5.png"
|
||||
dest_files=["res://.godot/imported/TilesetOf5.png-22b15725aed887164d6213d1fdf4228d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
MiniGames/FlappyCow/Art/TilesetOf52.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
34
MiniGames/FlappyCow/Art/TilesetOf52.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dibvdh46n5a0e"
|
||||
path="res://.godot/imported/TilesetOf52.png-b99e312a94913c936e876aff0294485c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/TilesetOf52.png"
|
||||
dest_files=["res://.godot/imported/TilesetOf52.png-b99e312a94913c936e876aff0294485c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
MiniGames/FlappyCow/Art/cowwing1.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
34
MiniGames/FlappyCow/Art/cowwing1.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ombwk8f3srit"
|
||||
path="res://.godot/imported/cowwing1.png-a3cce1391695a53b0410ae6405abd786.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/cowwing1.png"
|
||||
dest_files=["res://.godot/imported/cowwing1.png-a3cce1391695a53b0410ae6405abd786.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
MiniGames/FlappyCow/Art/cowwing2.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
34
MiniGames/FlappyCow/Art/cowwing2.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dqjxanyewvtkd"
|
||||
path="res://.godot/imported/cowwing2.png-c964f406ad219030f9567e783f7d5a69.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/cowwing2.png"
|
||||
dest_files=["res://.godot/imported/cowwing2.png-c964f406ad219030f9567e783f7d5a69.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
MiniGames/FlappyCow/Art/haystack.png
Normal file
|
After Width: | Height: | Size: 131 KiB |
34
MiniGames/FlappyCow/Art/haystack.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://nbn0qc28agv8"
|
||||
path="res://.godot/imported/haystack.png-6ed08714bea9fdccbdcaba77c7af65f3.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/haystack.png"
|
||||
dest_files=["res://.godot/imported/haystack.png-6ed08714bea9fdccbdcaba77c7af65f3.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
MiniGames/FlappyCow/Art/sun.png
Normal file
|
After Width: | Height: | Size: 5 KiB |
34
MiniGames/FlappyCow/Art/sun.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://mbt75ybru0mm"
|
||||
path="res://.godot/imported/sun.png-f37e4a35b05aa0f4d2696f9211193d5c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://MiniGames/FlappyCow/Art/sun.png"
|
||||
dest_files=["res://.godot/imported/sun.png-f37e4a35b05aa0f4d2696f9211193d5c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
11
MiniGames/FlappyCow/Player/AnimatedSprite2D.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends AnimatedSprite2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
100
MiniGames/FlappyCow/Player/FlappyCow.gd
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
|
||||
# BASIC MOVEMENT VARAIABLES ---------------- #
|
||||
var speed := 500
|
||||
|
||||
|
||||
# GRAVITY ----- #
|
||||
@export var gravity_acceleration : float = 3840
|
||||
@export var gravity_max : float = 1020
|
||||
|
||||
|
||||
# JUMP VARAIABLES ------------------- #
|
||||
@export var jump_force : float = 1400
|
||||
@export var jump_cut : float = 0.25
|
||||
@export var jump_gravity_max : float = 500
|
||||
|
||||
|
||||
|
||||
# All iputs we want to keep track of
|
||||
func get_input() -> Dictionary:
|
||||
return {
|
||||
"jump": Input.is_action_just_pressed("jump") == true,
|
||||
}
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
x_movement(delta)
|
||||
jump_logic(delta)
|
||||
apply_gravity(delta)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
func is_die():
|
||||
return false
|
||||
|
||||
|
||||
func x_movement(delta: float) -> void:
|
||||
velocity.x = 50*speed*delta
|
||||
#velocity.x = Vector2(velocity.x, 0).move_toward(Vector2(speed,0),1000*delta).x
|
||||
|
||||
|
||||
|
||||
func jump_logic(_delta: float) -> void:
|
||||
# Reset our jump requirements
|
||||
|
||||
|
||||
# Jump if grounded, there is jump input, and we aren't jumping already
|
||||
if get_input()["jump"]:
|
||||
$Sprite/AnimatedSprite2D.stop()
|
||||
$Sprite/AnimatedSprite2D.play("default")
|
||||
velocity.y = -jump_force
|
||||
|
||||
|
||||
|
||||
func apply_gravity(delta: float) -> void:
|
||||
var applied_gravity : float = 0
|
||||
|
||||
# Normal gravity limit
|
||||
if velocity.y <= gravity_max:
|
||||
applied_gravity = gravity_acceleration * delta
|
||||
|
||||
# If moving upwards while jumping, the limit is jump_gravity_max to achieve lower gravity
|
||||
if velocity.y > jump_gravity_max:
|
||||
applied_gravity = 0
|
||||
|
||||
velocity.y += applied_gravity
|
||||
|
||||
|
||||
func _on_area_2d_area_shape_entered(_area_rid, area, _area_shape_index, _local_shape_index):
|
||||
if area.is_in_group("Death") and speed > 0:
|
||||
|
||||
Suspend()
|
||||
get_node("Explosion").emitting = true
|
||||
get_node("CanvasLayer/SpilledLabel").visible = true
|
||||
|
||||
var timeSurvived = get_parent().timePlayed
|
||||
var xpReward = int(timeSurvived * 10)
|
||||
|
||||
await get_tree().create_timer(1).timeout
|
||||
get_node("/root/MainGame/CanvasLayer/MessageZone").visible = true
|
||||
get_node("/root/MainGame/CanvasLayer/MenuBar").visible = true
|
||||
get_node("/root/MainGame/CanvasLayer/MinimizeMessageZoneButton").visible = true
|
||||
get_tree().paused = false
|
||||
|
||||
LevelManager.add_XP("gaming", xpReward)
|
||||
|
||||
get_parent().queue_free() #exit on death
|
||||
|
||||
|
||||
func _on_animated_sprite_2d_animation_looped():
|
||||
$Sprite/AnimatedSprite2D.stop()
|
||||
|
||||
func Suspend():
|
||||
speed = 0
|
||||
$Camera2D/sun.speed = 0
|
||||
gravity_acceleration = 0
|
||||
velocity = Vector2(0,0)
|
||||
jump_force = 0
|
||||
|
||||
131
MiniGames/FlappyCow/Player/Player.tscn
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://bfijgdkhe4s1p"]
|
||||
|
||||
[ext_resource type="Script" path="res://MiniGames/FlappyCow/Player/FlappyCow.gd" id="1_pmws3"]
|
||||
[ext_resource type="Script" path="res://MiniGames/FlappyCow/Player/Sprite.gd" id="2_i7lbn"]
|
||||
[ext_resource type="Texture2D" uid="uid://ombwk8f3srit" path="res://MiniGames/FlappyCow/Art/cowwing1.png" id="3_jtwbd"]
|
||||
[ext_resource type="Texture2D" uid="uid://dqjxanyewvtkd" path="res://MiniGames/FlappyCow/Art/cowwing2.png" id="4_8f7l2"]
|
||||
|
||||
[sub_resource type="Animation" id="3"]
|
||||
resource_name = "Jump"
|
||||
length = 0.3
|
||||
step = 0.05
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.3),
|
||||
"transitions": PackedFloat32Array(1.68179, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(0.8, 1.2), Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="4"]
|
||||
resource_name = "Land"
|
||||
length = 0.2
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath(".:scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(0.241484, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(1, 1), Vector2(1.4, 1), Vector2(1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_1lb64"]
|
||||
_data = {
|
||||
"Jump": SubResource("3"),
|
||||
"Land": SubResource("4")
|
||||
}
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_vllpg"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("3_jtwbd")
|
||||
}, {
|
||||
"duration": 5.0,
|
||||
"texture": ExtResource("4_8f7l2")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 30.0
|
||||
}]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_10mlp"]
|
||||
|
||||
[node name="Player" type="CharacterBody2D" groups=["Player"]]
|
||||
z_index = 10
|
||||
collision_mask = 14
|
||||
floor_snap_length = 16.0
|
||||
script = ExtResource("1_pmws3")
|
||||
|
||||
[node name="Sprite" type="Node2D" parent="."]
|
||||
position = Vector2(0, 8)
|
||||
script = ExtResource("2_i7lbn")
|
||||
player_path = NodePath("..")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="Sprite"]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_1lb64")
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Sprite"]
|
||||
z_index = 101
|
||||
z_as_relative = false
|
||||
sprite_frames = SubResource("SpriteFrames_vllpg")
|
||||
flip_h = true
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Area2D"]
|
||||
polygon = PackedVector2Array(33, 59, 82, -23, 70, -42, 23, -41, 14, -11, -72, -4, -79, 58)
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(33, 59, 82, -23, 70, -42, 23, -41, 14, -11, -72, -4, -79, 58)
|
||||
|
||||
[node name="Explosion" type="CPUParticles2D" parent="."]
|
||||
emitting = false
|
||||
amount = 100
|
||||
one_shot = true
|
||||
explosiveness = 0.86
|
||||
randomness = 0.41
|
||||
spread = 180.0
|
||||
gravity = Vector2(0, 0)
|
||||
initial_velocity_min = 25.0
|
||||
initial_velocity_max = 142.0
|
||||
angular_velocity_max = 360.0
|
||||
linear_accel_max = 53.33
|
||||
radial_accel_max = 13.33
|
||||
scale_amount_min = 7.85
|
||||
scale_amount_max = 9.65
|
||||
color = Color(0.909804, 0.054902, 0, 1)
|
||||
color_ramp = SubResource("Gradient_10mlp")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="SpilledLabel" type="Label" parent="CanvasLayer"]
|
||||
visible = false
|
||||
offset_left = -29.0
|
||||
offset_top = 195.0
|
||||
offset_right = 941.0
|
||||
offset_bottom = 373.0
|
||||
theme_override_colors/font_color = Color(1, 0, 0, 1)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 9
|
||||
theme_override_constants/line_spacing = 0
|
||||
theme_override_font_sizes/font_size = 62
|
||||
text = "I SPIL MY JICE MODS
|
||||
HELP HELP HELP HEP HELP HELP"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[connection signal="animation_finished" from="Sprite/AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_finished"]
|
||||
[connection signal="animation_looped" from="Sprite/AnimatedSprite2D" to="." method="_on_animated_sprite_2d_animation_looped"]
|
||||
[connection signal="area_shape_entered" from="Area2D" to="." method="_on_area_2d_area_shape_entered"]
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
|
||||
24
MiniGames/FlappyCow/Player/Sprite.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends Node2D
|
||||
|
||||
@export var player_path : NodePath
|
||||
@onready var Player := get_node(player_path)
|
||||
@onready var Animator := $AnimationPlayer
|
||||
|
||||
var previous_frame_velocity := Vector2(0,0)
|
||||
|
||||
|
||||
# Avoid errors
|
||||
func _ready() -> void:
|
||||
if Player == null:
|
||||
print("Sprite.gd is missing player_path")
|
||||
set_process(false)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if previous_frame_velocity.y >= 0 and Player.velocity.y < 0:
|
||||
Animator.play("Jump")
|
||||
elif previous_frame_velocity.y > 0 and Player.is_on_floor():
|
||||
Animator.play("Land")
|
||||
|
||||
# It's important that this is the last thing done
|
||||
previous_frame_velocity = Player.velocity
|
||||
6
MiniGames/FlappyCow/ScreenCamera/ScreenCamera.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://lrbobe03y04y"]
|
||||
|
||||
[ext_resource type="Script" path="res://Flappycow/ScreenCamera/ScreenCamera.gd" id="1_twjag"]
|
||||
|
||||
[node name="ScreenCamera" type="Camera2D"]
|
||||
script = ExtResource("1_twjag")
|
||||
14
MiniGames/FlappyCow/World/Cloud.gd
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
extends Sprite2D
|
||||
|
||||
@export var speed = 100
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var velocity = Vector2(speed,0)
|
||||
var motion = velocity * delta
|
||||
position += motion
|
||||
17
MiniGames/FlappyCow/World/Sun.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
extends Sprite2D
|
||||
|
||||
@export var speed = -10
|
||||
var y_pos
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
y_pos = position.y
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var cameraPos = get_parent().get_screen_center_position()
|
||||
var velocity = Vector2(speed,0)
|
||||
global_position.y = 150
|
||||
var motion = velocity * delta
|
||||
|
||||
position += motion
|
||||
37
MiniGames/FlappyCow/World/TileMap.tscn
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://dxeva15lnv7wm"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dxtx8htjdu1mh" path="res://Art/TilesetOf5.png" id="1"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_aiwi6"]
|
||||
texture = ExtResource("1")
|
||||
texture_region_size = Vector2i(256, 256)
|
||||
1:1/0 = 0
|
||||
1:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
1:1/0/physics_layer_0/angular_velocity = 0.0
|
||||
1:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-128, -128, 128, -128, 128, 128, -128, 128)
|
||||
0:0/0 = 0
|
||||
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
0:0/0/physics_layer_0/angular_velocity = 0.0
|
||||
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(128, -128, 128, 128, -128, 128)
|
||||
2:0/0 = 0
|
||||
2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
2:0/0/physics_layer_0/angular_velocity = 0.0
|
||||
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-128, -128, -128, 128, 128, 128)
|
||||
2:2/0 = 0
|
||||
2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
2:2/0/physics_layer_0/angular_velocity = 0.0
|
||||
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-128, -128, 128, -128, -128, 128)
|
||||
0:2/0 = 0
|
||||
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||
0:2/0/physics_layer_0/angular_velocity = 0.0
|
||||
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-128, -128, 128, -128, 128, 128)
|
||||
|
||||
[sub_resource type="TileSet" id="10"]
|
||||
tile_size = Vector2i(256, 256)
|
||||
occlusion_layer_0/light_mask = 1
|
||||
physics_layer_0/collision_layer = 2
|
||||
sources/0 = SubResource("TileSetAtlasSource_aiwi6")
|
||||
|
||||
[node name="TileMap" type="TileMap"]
|
||||
tile_set = SubResource("10")
|
||||
format = 2
|
||||
39
MiniGames/FlappyCow/World/WallNode.gd
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
extends Node2D
|
||||
|
||||
@export var wall_count : float = 17
|
||||
@export var max_vert_diff : float = 300
|
||||
@export var wall_dist : float = 800
|
||||
|
||||
var vert_total : float = 300
|
||||
var vert_max : float = 710
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
if wall_count > 0:
|
||||
var copy = self.duplicate()
|
||||
copy.position.x = wall_dist
|
||||
|
||||
var dist = rng.randf_range(-max_vert_diff, max_vert_diff)
|
||||
|
||||
if vert_total <= 40: dist += 50
|
||||
if vert_total >= 670: dist -= 50
|
||||
|
||||
if dist + vert_total < 0:
|
||||
dist = -vert_total
|
||||
elif dist + vert_total > vert_max:
|
||||
dist = vert_max - vert_total
|
||||
|
||||
|
||||
copy.position.y = dist
|
||||
copy.wall_count = wall_count - 1
|
||||
copy.vert_total = dist + vert_total
|
||||
#print("Vtot: " + str(vert_total) + " Dist: " + str(dist))
|
||||
|
||||
self.add_child(copy)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
#Bee bad
|
||||
pass
|
||||
13
MiniGames/FlappyCow/World/WinText.gd
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
extends RichTextLabel
|
||||
|
||||
@onready var Animator := $AnimationPlayer
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
visible = false
|
||||
Animator.play("Wobble")
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
42
MiniGames/FlappyCow/World/World.gd
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
extends Node2D
|
||||
|
||||
var badge = preload("res://Items/Badges/FlappyCowBadge.gd")
|
||||
## Switching between fullscreen and not fullscreen by pressing esc
|
||||
|
||||
func _input(_event: InputEvent) -> void:
|
||||
pass
|
||||
|
||||
var won = false
|
||||
|
||||
var timePlayed = 0
|
||||
|
||||
func _ready():
|
||||
timePlayed = 0
|
||||
|
||||
func _process(delta):
|
||||
timePlayed += delta
|
||||
|
||||
func _on_finish_line_body_entered(body):
|
||||
|
||||
if body.is_in_group("Player") and !won:
|
||||
won = true
|
||||
body.Suspend()
|
||||
$WinText.visible = true
|
||||
$YellowFlower.visible = true
|
||||
$RedFlower.visible = true
|
||||
|
||||
await get_tree().create_timer(3).timeout
|
||||
get_node("/root/MainGame/CanvasLayer/MessageZone").visible = true
|
||||
get_node("/root/MainGame/CanvasLayer/MenuBar").visible = true
|
||||
get_node("/root/MainGame/CanvasLayer/MinimizeMessageZoneButton").visible = true
|
||||
get_tree().paused = false
|
||||
InventoryManager.add_item_to_inventory(badge.new(), 1, "keyItems")
|
||||
MessageManager.item_popup(badge.new())
|
||||
LevelManager.add_XP("gaming", 400)
|
||||
AchievementManager.complete_achievement("GOTY")
|
||||
queue_free()
|
||||
# run func that ends minigame and returns a score perhaps
|
||||
|
||||
|
||||
|
||||
|
||||