Skip to content

Commit

Permalink
Added BadVista minigame
Browse files Browse the repository at this point in the history
- Added BadVista minigame
- Has winstate but lose state not there yet.
  • Loading branch information
pokeparadox committed Dec 11, 2021
1 parent 2846b6e commit 68500e6
Show file tree
Hide file tree
Showing 29 changed files with 572 additions and 0 deletions.
134 changes: 134 additions & 0 deletions Games/BadVista.tscn
@@ -0,0 +1,134 @@
[gd_scene load_steps=14 format=2]

[ext_resource path="res://Games/BadVista/bvBkgnd.png" type="Texture" id=1]
[ext_resource path="res://Games/BadVista/BadVista.gd" type="Script" id=2]
[ext_resource path="res://Games/BadVista/pp.bv.windows.single.ogg" type="AudioStream" id=3]
[ext_resource path="res://Games/BadVista/Arm/Arm.tscn" type="PackedScene" id=4]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 10, 240 )

[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 400, 10 )

[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 80, 45 )

[sub_resource type="RectangleShape2D" id=6]
extents = Vector2( 4.139, 29.9635 )

[sub_resource type="RectangleShape2D" id=18]
extents = Vector2( 15.5696, 3.83113 )

[sub_resource type="RectangleShape2D" id=19]
extents = Vector2( 4.13901, 27.1076 )

[sub_resource type="RectangleShape2D" id=26]
extents = Vector2( 41.3717, 10 )

[sub_resource type="RectangleShape2D" id=27]
extents = Vector2( 26.2982, 112.344 )

[sub_resource type="RectangleShape2D" id=28]
extents = Vector2( 51.923, 24.9179 )

[node name="BadVista" type="Sprite"]
texture = ExtResource( 1 )
centered = false
script = ExtResource( 2 )

[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 3 )
autoplay = true

[node name="LeftWall" type="StaticBody2D" parent="."]
position = Vector2( 10, 240 )

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

[node name="RightWall" type="StaticBody2D" parent="."]
position = Vector2( 791, 240 )

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

[node name="TopWall" type="StaticBody2D" parent="."]
position = Vector2( 400, 10 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="TopWall"]
shape = SubResource( 2 )

[node name="BottomWall" type="StaticBody2D" parent="."]
position = Vector2( 400, 470 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="BottomWall"]
shape = SubResource( 2 )

[node name="Bad" type="StaticBody2D" parent="."]
position = Vector2( 88, 57 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="Bad"]
shape = SubResource( 3 )

[node name="V" type="StaticBody2D" parent="."]

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="V"]
polygon = PoolVector2Array( 30.7756, 117.489, 46.4017, 176.929, 51.6339, 176.929, 67.3305, 117.472, 59.2444, 117.472, 49.7313, 159.805, 40.2887, 117.014 )

[node name="I" type="StaticBody2D" parent="."]
position = Vector2( 89, 147 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="I"]
shape = SubResource( 6 )

[node name="S" type="StaticBody2D" parent="."]

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="S"]
polygon = PoolVector2Array( 136.371, 129.38, 142.079, 125.1, 137.322, 118.916, 131.139, 116.538, 122.577, 116.538, 117.345, 118.916, 113.064, 127.002, 112.588, 134.613, 115.918, 140.796, 119.247, 146.028, 133.517, 156.493, 134.468, 161.725, 132.09, 167.908, 126.858, 169.335, 121.15, 166.957, 117.345, 163.628, 111.637, 167.433, 114.015, 172.665, 118.772, 175.519, 124.004, 177.422, 131.614, 177.422, 137.322, 174.092, 141.603, 167.908, 143.506, 162.201, 142.554, 154.59, 140.176, 150.785, 127.809, 141.272, 122.577, 136.04, 121.15, 129.856, 124.479, 124.148, 131.614, 124.624 )

[node name="T" type="StaticBody2D" parent="."]
position = Vector2( 172, 149 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="T"]
position = Vector2( 0, -28 )
shape = SubResource( 18 )

[node name="CollisionShape2D 2" type="CollisionShape2D" parent="T"]
shape = SubResource( 19 )

[node name="A" type="StaticBody2D" parent="."]

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="A"]
polygon = PoolVector2Array( 210.573, 117.491, 218.659, 117.016, 233.88, 176.948, 224.842, 176.948, 220.561, 160.776, 207.719, 160.776, 204.389, 176.948, 195.352, 176.948 )

[node name="Bin" type="StaticBody2D" parent="."]

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="Bin"]
polygon = PoolVector2Array( 152.543, 374.868, 146.359, 375.819, 158.251, 449.07, 244.82, 449.07, 260.516, 376.295, 253.857, 374.868, 240.063, 441.935, 164.434, 441.46 )

[node name="Arm" parent="." instance=ExtResource( 4 )]
position = Vector2( 700, 272 )

[node name="WinArea" type="Area2D" parent="."]
position = Vector2( 201, 434 )
monitorable = false

[node name="BucketBase" type="CollisionShape2D" parent="WinArea"]
shape = SubResource( 26 )

[node name="ResetArea" type="Area2D" parent="."]
position = Vector2( 246, 0 )
monitoring = false
monitorable = false

[node name="Body" type="CollisionShape2D" parent="ResetArea"]
position = Vector2( 478, 336 )
shape = SubResource( 27 )

[node name="Arm" type="CollisionShape2D" parent="ResetArea"]
position = Vector2( 465, 297 )
shape = SubResource( 28 )

[connection signal="body_entered" from="WinArea" to="." method="_on_WinArea_body_entered"]
[connection signal="body_entered" from="ResetArea" to="." method="_on_ResetArea_body_entered"]
23 changes: 23 additions & 0 deletions Games/BadVista/Arm/Arm.gd
@@ -0,0 +1,23 @@
extends Node2D

export var power = 0.0

func _ready():
set_process(true)
var player = self.get_node("Player")
player.play("Throw")

func Throw():
var player = self.get_node("Player")
player.stop(true)

#var ang = get_node(".").get_rotd()
var xVel = -power*3
var yVel = -power*2
var logo = get_node("WinLogo/KinematicBody2D")
logo.set_linear_velocity(Vector2(xVel, yVel))
logo.set_mode(0)

func _process(delta):
if Input.is_action_pressed("ui_accept"):
Throw()
73 changes: 73 additions & 0 deletions Games/BadVista/Arm/Arm.tscn
@@ -0,0 +1,73 @@
[gd_scene load_steps=6 format=2]

[ext_resource path="res://Games/BadVista/Arm/Arm.gd" type="Script" id=1]
[ext_resource path="res://Games/BadVista/Arm/bvArm.png" type="Texture" id=2]
[ext_resource path="res://Games/BadVista/Logo/WinLogo.tscn" type="PackedScene" id=3]

[sub_resource type="Animation" id=2]
length = 0.001
tracks/0/type = "value"
tracks/0/path = NodePath("WinLogo:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath(".:rotation_degrees")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 0,
"values": [ 0.0 ]
}

[sub_resource type="Animation" id=1]
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2, 0.8, 1 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 0,
"values": [ 55.0, 25.0, 0.0, 55.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath(".:power")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ 0.0, 100.0 ]
}

[node name="Arm" type="Node2D"]
script = ExtResource( 1 )
power = 48.5564

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

[node name="Player" type="AnimationPlayer" parent="."]
anims/RESET = SubResource( 2 )
anims/Throw = SubResource( 1 )

[node name="WinLogo" parent="." instance=ExtResource( 3 )]
position = Vector2( -73, 25 )
Binary file added Games/BadVista/Arm/bvArm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Games/BadVista/Arm/bvArm.png.flags
@@ -0,0 +1 @@
gen_mipmaps=false
35 changes: 35 additions & 0 deletions Games/BadVista/Arm/bvArm.png.import
@@ -0,0 +1,35 @@
[remap]

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

[deps]

source_file="res://Games/BadVista/Arm/bvArm.png"
dest_files=[ "res://.import/bvArm.png-3bc6b25f8f726e1679c2b9abd1513a2b.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
15 changes: 15 additions & 0 deletions Games/BadVista/BadVista.gd
@@ -0,0 +1,15 @@
extends Node2D


func _on_WinArea_body_entered(body: Node) -> void:
# Check velocity is lowering and then set win condition
Score.GameWin()


func _on_ResetArea_body_entered(body: Node) -> void:
# Reset logo back into hand
pass

# Check for losing condition when logo comes to rest on floor

# Fix multiple throw bug
23 changes: 23 additions & 0 deletions Games/BadVista/Logo/WinLogo.gd
@@ -0,0 +1,23 @@
extends Node2D

var bounces = 0

func _ready():
bounces = 0

func _on_KinematicBody2D_body_enter( body ):
checkBounces()

func _on_KinematicBody2D_body_enter_shape( body_id, body, body_shape, local_shape ):
checkBounces()

func checkBounces():
get_node("Ding").play()
bounces = bounces + 1

if bounces > 5:
var col = get_node("KinematicBody2D")
col.set_contact_monitor(false)
col.set_process(false)
set_pause_mode(PAUSE_MODE_STOP)
bounces = 0
29 changes: 29 additions & 0 deletions Games/BadVista/Logo/WinLogo.tscn
@@ -0,0 +1,29 @@
[gd_scene load_steps=5 format=2]

[ext_resource path="res://Games/BadVista/Logo/WinLogo.gd" type="Script" id=1]
[ext_resource path="res://Games/BadVista/Logo/bvLogo.png" type="Texture" id=2]
[ext_resource path="res://Games/BadVista/Logo/ding.ogg" type="AudioStream" id=3]

[sub_resource type="PhysicsMaterial" id=1]
friction = 0.1
bounce = 0.85

[node name="WinLogo" type="Node2D"]
script = ExtResource( 1 )

[node name="KinematicBody2D" type="RigidBody2D" parent="."]
mode = 3
mass = 0.2
physics_material_override = SubResource( 1 )
continuous_cd = 2
contacts_reported = 2
contact_monitor = true

[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="KinematicBody2D"]
polygon = PoolVector2Array( -27.7203, -8.15999, -12.6854, 31.0007, -10.5875, 31.3504, -7.7903, 29.9518, -2.54556, 23.6581, 4.09777, 20.8609, 12.4894, 20.1616, 19.832, 17.0148, 26.825, 8.62318, 12.839, -30.5375, 8.64321, -31.2368, 5.49637, -26.6914, -0.797318, -20.7474, -15.8322, -18.9991, -21.077, -16.2019 )

[node name="Sprite" type="Sprite" parent="KinematicBody2D/CollisionPolygon2D"]
texture = ExtResource( 2 )

[node name="Ding" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 3 )
Binary file added Games/BadVista/Logo/bvLogo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Games/BadVista/Logo/bvLogo.png.flags
@@ -0,0 +1,2 @@
filter=false
gen_mipmaps=false
35 changes: 35 additions & 0 deletions Games/BadVista/Logo/bvLogo.png.import
@@ -0,0 +1,35 @@
[remap]

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

[deps]

source_file="res://Games/BadVista/Logo/bvLogo.png"
dest_files=[ "res://.import/bvLogo.png-040eeeabc7ce93b681447e127ffe9ae5.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
Binary file added Games/BadVista/Logo/ding.ogg
Binary file not shown.
15 changes: 15 additions & 0 deletions Games/BadVista/Logo/ding.ogg.import
@@ -0,0 +1,15 @@
[remap]

importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/ding.ogg-0efcc310e16b70994a48e190375e8669.oggstr"

[deps]

source_file="res://Games/BadVista/Logo/ding.ogg"
dest_files=[ "res://.import/ding.ogg-0efcc310e16b70994a48e190375e8669.oggstr" ]

[params]

loop=true
loop_offset=0
Binary file added Games/BadVista/bvBkgnd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Games/BadVista/bvBkgnd.png.flags
@@ -0,0 +1,2 @@
filter=false
gen_mipmaps=false

0 comments on commit 68500e6

Please sign in to comment.