Commit ee7c1190 authored by ryan.mills's avatar ryan.mills

test

parents
# 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
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation
# Mono-specific ignores
.mono/
data_*/
extends CanvasLayer
var coins = 0
func _ready():
$Coins.text = String(coins)
func _on_coin_collected():
coins += 1
_ready()
if coins == 7:
get_tree().change_scene("gameover.tscn")
MIT License
Copyright (c) 2016-2022 The Godot Engine community
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This diff is collapsed.
[general]
load_once=true
symbol_prefix="godot_"
reloadable=false
singleton=false
[entry]
OSX.64="res://addons/godot-git-plugin/osx/libgitapi.dylib"
Windows.64="res://addons/godot-git-plugin/win64/libgitapi.dll"
X11.64="res://addons/godot-git-plugin/linux/libgitapi.so"
[dependencies]
OSX.64=[ ]
Windows.64=[ ]
X11.64=[ ]
[gd_resource type="NativeScript" load_steps=2 format=2]
[ext_resource path="res://addons/godot-git-plugin/git_api.gdnlib" type="GDNativeLibrary" id=1]
[resource]
resource_name = "GitAPI"
class_name = "GitAPI"
library = ExtResource( 1 )
script_class_name = "GitAPI"
[plugin]
name="Godot Git Plugin"
description="This plugin lets you interact with Git without leaving the Godot editor. More information can be found at https://github.com/godotengine/godot-git-plugin/wiki"
author="ChronicallySerious"
version="v2.1.0"
script="git_api.gdns"
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/coin_gold.png-f1e74e3f1e0be41ff1a39c6755ab2b1c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/coin_gold.png"
dest_files=[ "res://.import/coin_gold.png-f1e74e3f1e0be41ff1a39c6755ab2b1c.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/dg.png-4d9308c2966f4ef68587e0f108f49d1d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/dg.png"
dest_files=[ "res://.import/dg.png-4d9308c2966f4ef68587e0f108f49d1d.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/dirt.png-0a1ee02e0310eb6b032db25fe6920ea9.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/dirt.png"
dest_files=[ "res://.import/dirt.png-0a1ee02e0310eb6b032db25fe6920ea9.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/grss.png-04eff895b632fa37e49529bbcdc42591.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/grss.png"
dest_files=[ "res://.import/grss.png-04eff895b632fa37e49529bbcdc42591.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/lava.png-7a5111e57817f5e0bce4c46b58caa642.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/lava.png"
dest_files=[ "res://.import/lava.png-7a5111e57817f5e0bce4c46b58caa642.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/slimeBlue.png-076b558edca9aff9b6f184b7955147d0.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/slimeBlue.png"
dest_files=[ "res://.import/slimeBlue.png-076b558edca9aff9b6f184b7955147d0.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/slimeBlue_blue.png-4db0f67e5dacefced25976eede317c69.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/slimeBlue_blue.png"
dest_files=[ "res://.import/slimeBlue_blue.png-4db0f67e5dacefced25976eede317c69.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/slimeBlue_squashed.png-c38e399c40261ac311f863d3efa1983b.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/slimeBlue_squashed.png"
dest_files=[ "res://.import/slimeBlue_squashed.png-c38e399c40261ac311f863d3efa1983b.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
This diff was suppressed by a .gitattributes entry.
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/spritesheet 2.png-07ea0e2b0f977a83610f3b5963c79b8d.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/spritesheet 2.png"
dest_files=[ "res://.import/spritesheet 2.png-07ea0e2b0f977a83610f3b5963c79b8d.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
extends Area2D
signal coin_collected
func _on_coin_body_entered(body):
if body.has_method("GetCoin"):
emit_signal("coin_collected")
body.GetCoin()
queue_free()
[gd_scene load_steps=4 format=2]
[ext_resource path="res://coin.gd" type="Script" id=1]
[ext_resource path="res://assets/coin_gold.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 31.5, 32 )
[node name="coin" type="Area2D"]
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( 32, 32 )
scale = Vector2( 0.25, 0.25 )
texture = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 32, 32 )
scale = Vector2( 0.25, 0.25 )
shape = SubResource( 1 )
[connection signal="body_entered" from="." to="." method="_on_coin_body_entered"]
[gd_resource type="Environment" load_steps=2 format=2]
[sub_resource type="ProceduralSky" id=1]
[resource]
background_mode = 2
background_sky = SubResource( 1 )
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/dg.png-c73c1061d31076a765ce1075095b822a.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://dg.png"
dest_files=[ "res://.import/dg.png-c73c1061d31076a765ce1075095b822a.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/dirt.png-81db9f47be16674f640109976e043256.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://dirt.png"
dest_files=[ "res://.import/dirt.png-81db9f47be16674f640109976e043256.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
extends CanvasLayer
func _ready():
pass # Replace with function body.
func _on_restart_pressed():
get_tree().change_scene("menu.tscn")
func _on_quit_pressed():
get_tree().quit()
[gd_scene load_steps=7 format=2]
[ext_resource path="res://fonts/BalsamiqSans-Bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://gameover.gd" type="Script" id=2]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.247059, 0.247059, 0.247059, 1 )
border_width_left = 10
border_width_top = 10
border_width_right = 10
border_width_bottom = 10
border_color = Color( 0, 0, 0, 1 )
[sub_resource type="DynamicFont" id=2]
size = 45
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=3]
size = 20
font_data = ExtResource( 1 )
[sub_resource type="DynamicFont" id=4]
size = 20
font_data = ExtResource( 1 )
[node name="GameOverScreen" type="CanvasLayer"]
script = ExtResource( 2 )
[node name="PanelContainer" type="PanelContainer" parent="."]
margin_left = 40.0
margin_top = 40.0
margin_right = 984.0
margin_bottom = 560.0
custom_styles/panel = SubResource( 1 )
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer"]
margin_left = 10.0
margin_top = 10.0
margin_right = 934.0
margin_bottom = 510.0
custom_constants/margin_right = 40
custom_constants/margin_top = 40
custom_constants/margin_left = 40
custom_constants/margin_bottom = 40
[node name="rows" type="VBoxContainer" parent="PanelContainer/MarginContainer"]
margin_left = 40.0
margin_top = 40.0
margin_right = 884.0
margin_bottom = 460.0
custom_constants/separation = 100
[node name="title" type="Label" parent="PanelContainer/MarginContainer/rows"]
margin_right = 844.0
margin_bottom = 55.0
custom_fonts/font = SubResource( 2 )
text = "Game Over"
align = 1
[node name="CenterContainer" type="CenterContainer" parent="PanelContainer/MarginContainer/rows"]
margin_top = 155.0
margin_right = 844.0
margin_bottom = 225.0
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/MarginContainer/rows/CenterContainer"]
margin_left = 356.0
margin_right = 488.0
margin_bottom = 70.0
custom_constants/separation = 10
[node name="restart" type="Button" parent="PanelContainer/MarginContainer/rows/CenterContainer/VBoxContainer"]
margin_right = 132.0
margin_bottom = 30.0
custom_fonts/font = SubResource( 3 )
text = " Main Menu "
[node name="quit" type="Button" parent="PanelContainer/MarginContainer/rows/CenterContainer/VBoxContainer"]
margin_top = 40.0
margin_right = 132.0
margin_bottom = 70.0
custom_fonts/font = SubResource( 4 )
text = "Quit"
[connection signal="pressed" from="PanelContainer/MarginContainer/rows/CenterContainer/VBoxContainer/restart" to="." method="_on_restart_pressed"]
[connection signal="pressed" from="PanelContainer/MarginContainer/rows/CenterContainer/VBoxContainer/quit" to="." method="_on_quit_pressed"]
extends Node
var coins = 0
func set_variable(var coins):
coins = 0
func get_variable():
return coins
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/grss.png-013f7ea71d8c3bcfc0cf318a37e4c241.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://grss.png"
dest_files=[ "res://.import/grss.png-013f7ea71d8c3bcfc0cf318a37e4c241.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
This diff was suppressed by a .gitattributes entry.
[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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/lava.png-362957d11c12c0ad41755679afebc004.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://lava.png"
dest_files=[ "res://.import/lava.png-362957d11c12c0ad41755679afebc004.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _on_start_pressed():
get_tree().change_scene("world.tscn")
func _on_quit_pressed():
get_tree().quit()
[gd_scene load_steps=2 format=2]
[ext_resource path="res://menu.gd" type="Script" id=1]
[node name="menu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 448.0
margin_top = 200.0
margin_right = 576.0
margin_bottom = 364.0
alignment = 1
[node name="start" type="Button" parent="VBoxContainer"]
margin_top = 60.0
margin_right = 128.0
margin_bottom = 80.0
text = "Start"
[node name="quit" type="Button" parent="VBoxContainer"]
margin_top = 84.0
margin_right = 128.0
margin_bottom = 104.0
text = "Quit"
[connection signal="pressed" from="VBoxContainer/start" to="." method="_on_start_pressed"]
[connection signal="pressed" from="VBoxContainer/quit" to="." method="_on_quit_pressed"]
extends KinematicBody2D
const UP = Vector2(0,-1)
const GRAVITY = 25
const MAXFALLSPEED = 250
const MAXSPEED = 150
const JUMPFORCE = 400
const ACCEL = 10
var motion = Vector2()
var facing_right = true
var coins = 0
func _ready():
pass # Replace with function body.
func _physics_process(delta):
motion.y += GRAVITY
if motion.y > MAXFALLSPEED:
motion.y = MAXFALLSPEED
if facing_right == true:
$Sprite.scale.x = 1
else:
$Sprite.scale.x = -1
motion.x = clamp(motion.x, -MAXSPEED, MAXSPEED)
if Input.is_action_pressed("right"):
motion.x += ACCEL
facing_right = true
$AnimationPlayer.play("walking")
elif Input.is_action_pressed("left"):
motion.x -= ACCEL
facing_right = false
$AnimationPlayer.play("walking")
else:
motion.x = lerp(motion.x, 0, 0.2)
$AnimationPlayer.play("idle")
if is_on_floor():
if Input.is_action_just_pressed("jump"):
motion.y = -JUMPFORCE
if !is_on_floor():
if motion.y < 0:
$AnimationPlayer.play("jump")
elif motion.y > 0:
$AnimationPlayer.play("falling")
motion = move_and_slide(motion, UP)
if Input.is_action_pressed("esc"):
get_tree().change_scene("menu.tscn")
func GetCoin():
coins += 1
func bounce():
motion.y = -JUMPFORCE*1.5
func _on_deathbox_body_entered(body):
get_tree().change_scene("gameover.tscn")
; 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="2D Platformer"
run/main_scene="res://menu.tscn"
config/icon="res://icon.png"
[editor]
version_control_autoload_on_startup=true
version_control_plugin_name="GitAPI"
[gui]
common/drop_mouse_on_gui_input_disabled=true
[input]
right={
"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":0,"physical_scancode":68,"unicode":0,"echo":false,"script":null)
]
}
left={
"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":0,"physical_scancode":65,"unicode":0,"echo":false,"script":null)
]
}
jump={
"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":0,"physical_scancode":32,"unicode":0,"echo":false,"script":null)
]
}
esc={
"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":0,"physical_scancode":16777217,"unicode":0,"echo":false,"script":null)
]
}
[physics]
common/enable_pause_aware_picking=true
[rendering]
environment/default_environment="res://default_env.tres"
extends KinematicBody2D
const UP = Vector2(0,-1)
const GRAVITY = 25
const MAXFALLSPEED = 250
const MAXSPEED = 150
const JUMPFORCE = 400
const ACCEL = 10
var dead = false
var velocity = Vector2()
var motion = Vector2()
var facing_right = true
export var direction = -1
export var detects_drops = true
func _ready():
if direction == 1:
$AnimatedSprite.flip_h = true
$floor_checker.position.x = $CollisionShape2D.shape.get_extents().x * direction
func _physics_process(delta):
if not dead:
if is_on_wall():
direction = direction*-1
$AnimatedSprite.flip_h = not$AnimatedSprite.flip_h
$floor_checker.position.x = $CollisionShape2D.shape.get_extents().x * direction
if not $floor_checker.is_colliding() and is_on_floor() and detects_drops:
direction = direction*-1
$AnimatedSprite.flip_h = not$AnimatedSprite.flip_h
$floor_checker.position.x = $CollisionShape2D.shape.get_extents().x * direction
velocity.y += GRAVITY
velocity.x = 30*direction
velocity = move_and_slide(velocity,Vector2.UP)
func _on_top_checker_body_entered(body):
$AnimatedSprite.play("squished")
dead = true
set_collision_layer_bit(0,false)
set_collision_layer_bit(1,false)
set_collision_layer_bit(2,false)
set_collision_mask_bit(0, false)
set_collision_mask_bit(1, false)
$top_checker.set_collision_mask_bit(1, false)
$top_checker.set_collision_layer_bit(1, false)
$Timer.start()
body.bounce()
func _on_side_checker_body_entered(body):
if not dead:
get_tree().change_scene("gameover.tscn")
func _on_Timer_timeout():
queue_free()
[gd_scene load_steps=9 format=2]
[ext_resource path="res://slimeBlue_squashed.png" type="Texture" id=1]
[ext_resource path="res://slimeBlue_blue.png" type="Texture" id=2]
[ext_resource path="res://slimeBlue.png" type="Texture" id=3]
[ext_resource path="res://slime.gd" type="Script" id=4]
[sub_resource type="SpriteFrames" id=1]
animations = [ {
"frames": [ ExtResource( 3 ), ExtResource( 2 ) ],
"loop": true,
"name": "gloop",
"speed": 5.0
}, {
"frames": [ ExtResource( 1 ) ],
"loop": true,
"name": "squished",
"speed": 5.0
} ]
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 24, 12 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 19.5, 4 )
[sub_resource type="RectangleShape2D" id=4]
extents = Vector2( 29, 10 )
[node name="slime" type="KinematicBody2D"]
script = ExtResource( 4 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = SubResource( 1 )
animation = "gloop"
frame = 1
speed_scale = 0.5
playing = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, 4 )
shape = SubResource( 2 )
[node name="floor_checker" type="RayCast2D" parent="."]
enabled = true
cast_to = Vector2( 0, 25 )
[node name="top_checker" type="Area2D" parent="."]
collision_layer = 2
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="top_checker"]
position = Vector2( 0.5, -13 )
shape = SubResource( 3 )
[node name="side_checker" type="Area2D" parent="."]
collision_layer = 2
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="side_checker"]
position = Vector2( 0, 5 )
shape = SubResource( 4 )
[node name="Timer" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[connection signal="body_entered" from="top_checker" to="." method="_on_top_checker_body_entered"]
[connection signal="body_entered" from="side_checker" to="." method="_on_side_checker_body_entered"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/slimeBlue.png-3ee96ca5c2743bb61f98b68d9658022c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://slimeBlue.png"
dest_files=[ "res://.import/slimeBlue.png-3ee96ca5c2743bb61f98b68d9658022c.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/slimeBlue_blue.png-219a6e8d3c6707deaa1b9962ae49aead.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://slimeBlue_blue.png"
dest_files=[ "res://.import/slimeBlue_blue.png-219a6e8d3c6707deaa1b9962ae49aead.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/slimeBlue_squashed.png-c84c63de61630d2e66263e1bbf1a8f63.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://slimeBlue_squashed.png"
dest_files=[ "res://.import/slimeBlue_squashed.png-c84c63de61630d2e66263e1bbf1a8f63.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
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/spritesheet 2.png-9003a950fb6427e0022bf6d3c18afbf2.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://spritesheet 2.png"
dest_files=[ "res://.import/spritesheet 2.png-9003a950fb6427e0022bf6d3c18afbf2.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/spritesheet.png-59f7dfdebfc035c80a63445e3bd8a9bd.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://spritesheet.png"
dest_files=[ "res://.import/spritesheet.png-59f7dfdebfc035c80a63445e3bd8a9bd.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
[gd_scene load_steps=4 format=2]
[ext_resource path="res://dg.png" type="Texture" id=1]
[ext_resource path="res://lava.png" type="Texture" id=2]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 160, 160 )
[node name="Node2D" type="Node2D"]
[node name="Sprite" type="Sprite" parent="."]
scale = Vector2( 0.25, 0.25 )
texture = ExtResource( 1 )
vframes = 2
[node name="StaticBody2D" type="StaticBody2D" parent="Sprite"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite/StaticBody2D"]
position = Vector2( 3.8147e-06, 0 )
shape = SubResource( 1 )
[node name="Sprite2" type="Sprite" parent="."]
position = Vector2( 88, 0 )
scale = Vector2( 0.25, 0.25 )
texture = ExtResource( 1 )
vframes = 2
frame = 1
[node name="StaticBody2D" type="StaticBody2D" parent="Sprite2"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite2/StaticBody2D"]
position = Vector2( 3.8147e-06, 0 )
shape = SubResource( 1 )
[node name="Sprite3" type="Sprite" parent="."]
position = Vector2( 176, 0 )
scale = Vector2( 0.25, 0.25 )
texture = ExtResource( 2 )
[node name="StaticBody2D" type="StaticBody2D" parent="Sprite3"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Sprite3/StaticBody2D"]
position = Vector2( 3.8147e-06, 0 )
shape = SubResource( 1 )
[gd_resource type="TileSet" load_steps=3 format=2]
[ext_resource path="res://dg.png" type="Texture" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 160, 160 )
[resource]
0/name = "Sprite"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
0/modulate = Color( 1, 1, 1, 1 )
0/region = Rect2( 0, 0, 319, 319 )
0/tile_mode = 0
0/occluder_offset = Vector2( 159.5, 159.75 )
0/navigation_offset = Vector2( 159.5, 159.75 )
0/shape_offset = Vector2( 159.5, 159.75 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 159.5, 159.75 )
0/shape = SubResource( 1 )
0/shape_one_way = false
0/shape_one_way_margin = 1.0
0/shapes = [ {
"autotile_coord": Vector2( 0, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 159.5, 159.75 )
} ]
0/z_index = 0
1/name = "Sprite2"
1/texture = ExtResource( 1 )
1/tex_offset = Vector2( 0, 0 )
1/modulate = Color( 1, 1, 1, 1 )
1/region = Rect2( 0, 319, 319, 319 )
1/tile_mode = 0
1/occluder_offset = Vector2( 159.5, 159.75 )
1/navigation_offset = Vector2( 159.5, 159.75 )
1/shape_offset = Vector2( 159.5, 159.75 )
1/shape_transform = Transform2D( 1, 0, 0, 1, 159.5, 159.75 )
1/shape = SubResource( 1 )
1/shape_one_way = false
1/shape_one_way_margin = 1.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, 159.5, 159.75 )
} ]
1/z_index = 0
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment