Init
This commit is contained in:
commit
e7889a7a65
|
@ -0,0 +1,2 @@
|
|||
*.import/
|
||||
assets/
|
|
@ -0,0 +1,67 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/art/ground-sheet.png" type="Texture" id=1]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
0/name = "ground-sheet.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 0, 0, 64, 64 )
|
||||
0/tile_mode = 0
|
||||
0/occluder_offset = Vector2( 0, 0 )
|
||||
0/navigation_offset = Vector2( 0, 0 )
|
||||
0/shape_offset = Vector2( 0, 0 )
|
||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
0/shape_one_way = false
|
||||
0/shape_one_way_margin = 0.0
|
||||
0/shapes = [ ]
|
||||
0/z_index = 0
|
||||
1/name = "ground-sheet.png 1"
|
||||
1/texture = ExtResource( 1 )
|
||||
1/tex_offset = Vector2( 0, 0 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 0, 64, 64, 64 )
|
||||
1/tile_mode = 0
|
||||
1/occluder_offset = Vector2( 0, 0 )
|
||||
1/navigation_offset = Vector2( 0, 0 )
|
||||
1/shape_offset = Vector2( 0, 0 )
|
||||
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
1/shape_one_way = false
|
||||
1/shape_one_way_margin = 0.0
|
||||
1/shapes = [ ]
|
||||
1/z_index = 0
|
||||
2/name = "ground-sheet.png 2"
|
||||
2/texture = ExtResource( 1 )
|
||||
2/tex_offset = Vector2( 0, 0 )
|
||||
2/modulate = Color( 1, 1, 1, 1 )
|
||||
2/region = Rect2( 64, 64, 64, 64 )
|
||||
2/tile_mode = 0
|
||||
2/occluder_offset = Vector2( 0, 0 )
|
||||
2/navigation_offset = Vector2( 0, 0 )
|
||||
2/shape_offset = Vector2( 0, 0 )
|
||||
2/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
2/shape_one_way = false
|
||||
2/shape_one_way_margin = 0.0
|
||||
2/shapes = [ ]
|
||||
2/z_index = 0
|
||||
3/name = "ground-sheet.png 3"
|
||||
3/texture = ExtResource( 1 )
|
||||
3/tex_offset = Vector2( 0, 0 )
|
||||
3/modulate = Color( 1, 1, 1, 1 )
|
||||
3/region = Rect2( 64, 0, 64, 64 )
|
||||
3/tile_mode = 0
|
||||
3/occluder_offset = Vector2( 0, 0 )
|
||||
3/navigation_offset = Vector2( 0, 0 )
|
||||
3/shape_offset = Vector2( 0, 0 )
|
||||
3/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
3/shape_one_way = false
|
||||
3/shape_one_way_margin = 0.0
|
||||
3/shapes = [ ]
|
||||
3/z_index = 0
|
||||
|
||||
[node name="TileMap" type="TileMap"]
|
||||
show_behind_parent = true
|
||||
tile_set = SubResource( 1 )
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 0, 0, 0, 1, 0, 0, 2, 2, 0, 3, 2, 0, 4, 2, 0, 5, 2, 0, 6, 2, 0, 7, 2, 0, 8, 2, 0, 9, 2, 0, 10, 2, 0, 11, 2, 0, 12, 3, 0, 13, 3, 0, 14, 2, 0, 15, 2, 0, 65536, 2, 0, 65537, 2, 0, 65538, 0, 0, 65539, 1, 0, 65540, 1, 0, 65541, 1, 0, 65542, 2, 0, 65543, 2, 0, 65544, 2, 0, 65545, 2, 0, 65546, 2, 0, 65547, 2, 0, 65548, 3, 0, 65549, 3, 0, 65550, 3, 0, 65551, 2, 0, 131072, 3, 0, 131073, 3, 0, 131074, 1, 0, 131075, 1, 0, 131076, 1, 0, 131077, 2, 0, 131078, 2, 0, 131079, 2, 0, 131080, 2, 0, 131081, 2, 0, 131082, 2, 0, 131083, 0, 0, 131084, 0, 0, 131085, 3, 0, 131086, 3, 0, 131087, 3, 0, 196608, 3, 0, 196609, 2, 0, 196610, 3, 0, 196611, 3, 0, 196612, 1, 0, 196613, 1, 0, 196614, 1, 0, 196615, 1, 0, 196616, 1, 0, 196617, 3, 0, 196618, 0, 0, 196619, 0, 0, 196620, 1, 0, 196621, 1, 0, 196622, 2, 0, 196623, 2, 0, 262144, 2, 0, 262145, 2, 0, 262146, 3, 0, 262147, 3, 0, 262148, 3, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 0, 0, 262153, 0, 0, 262154, 3, 0, 262155, 3, 0, 262156, 3, 0, 262157, 1, 0, 262158, 2, 0, 262159, 2, 0, 327680, 2, 0, 327681, 3, 0, 327682, 2, 0, 327683, 2, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 327687, 0, 0, 327688, 3, 0, 327689, 0, 0, 327690, 2, 0, 327691, 3, 0, 327692, 3, 0, 327693, 3, 0, 327694, 2, 0, 327695, 2, 0, 393216, 2, 0, 393217, 2, 0, 393218, 2, 0, 393219, 2, 0, 393220, 2, 0, 393221, 0, 0, 393222, 0, 0, 393223, 0, 0, 393224, 0, 0, 393225, 0, 0, 393226, 3, 0, 393227, 3, 0, 393228, 3, 0, 393229, 3, 0, 393230, 1, 0, 393231, 2, 0, 458752, 2, 0, 458753, 2, 0, 458754, 2, 0, 458755, 3, 0, 458756, 3, 0, 458757, 3, 0, 458758, 3, 0, 458759, 3, 0, 458760, 3, 0, 458761, 2, 0, 458762, 2, 0, 458763, 2, 0, 458764, 2, 0, 458765, 2, 0, 458766, 2, 0, 458767, 2, 0, 524288, 2, 0, 524289, 0, 0, 524290, 0, 0, 524291, 0, 0, 524292, 2, 0, 524293, 2, 0, 524294, 2, 0, 524295, 2, 0, 524296, 2, 0, 524297, 0, 0, 524298, 0, 0, 524299, 2, 0, 524300, 2, 0, 524301, 2, 0, 524302, 2, 0, 524303, 2, 0, 589824, 2, 0, 589825, 0, 0, 589826, 2, 0, 589827, 2, 0, 589828, 2, 0, 589829, 2, 0, 589830, 0, 0, 589831, 0, 0, 589832, 0, 0, 589833, 2, 0, 589834, 2, 0, 589835, 2, 0, 589836, 2, 0, 589837, 2, 0, 589838, 2, 0, 589839, 2, 0, 655361, 0, 0, 655362, 0, 0, 655363, 0, 0, 655364, 0, 0, 655365, 0, 0 )
|
|
@ -0,0 +1,7 @@
|
|||
extends Node
|
||||
|
||||
func _ready():
|
||||
newGame()
|
||||
|
||||
func newGame():
|
||||
$Player.start($StartPosition.position)
|
|
@ -0,0 +1,20 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://test-scene.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Main.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Ground.tscn" type="PackedScene" id=4]
|
||||
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="TileMap" parent="." instance=ExtResource( 4 )]
|
||||
collision_layer = 2
|
||||
collision_mask = 0
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 1 )]
|
||||
position = Vector2( 65.481, 38.7541 )
|
||||
scale = Vector2( 1.5, 1.5 )
|
||||
collision_mask = 0
|
||||
|
||||
[node name="StartPosition" type="Position2D" parent="."]
|
||||
position = Vector2( 240, 450 )
|
|
@ -0,0 +1,12 @@
|
|||
extends RigidBody2D
|
||||
|
||||
export var min_speed = 150 # Minimum speed range.
|
||||
export var max_speed = 250 # Maximum speed range.
|
||||
|
||||
func _ready():
|
||||
var mob_types = $AnimatedSprite.frames.get_animation_names()
|
||||
$AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
#queue_free()
|
||||
pass
|
|
@ -0,0 +1,51 @@
|
|||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://dodge_assets/art/enemySwimming_1.png" type="Texture" id=1]
|
||||
[ext_resource path="res://dodge_assets/art/enemyWalking_1.png" type="Texture" id=2]
|
||||
[ext_resource path="res://dodge_assets/art/enemySwimming_2.png" type="Texture" id=3]
|
||||
[ext_resource path="res://dodge_assets/art/enemyFlyingAlt_2.png" type="Texture" id=4]
|
||||
[ext_resource path="res://dodge_assets/art/enemyFlyingAlt_1.png" type="Texture" id=5]
|
||||
[ext_resource path="res://dodge_assets/art/enemyWalking_2.png" type="Texture" id=6]
|
||||
[ext_resource path="res://Mob.gd" type="Script" id=7]
|
||||
|
||||
[sub_resource type="SpriteFrames" id=1]
|
||||
animations = [ {
|
||||
"frames": [ ExtResource( 5 ), ExtResource( 4 ) ],
|
||||
"loop": true,
|
||||
"name": "fly",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 2 ), ExtResource( 6 ) ],
|
||||
"loop": true,
|
||||
"name": "walk",
|
||||
"speed": 3.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 1 ), ExtResource( 3 ) ],
|
||||
"loop": true,
|
||||
"name": "swim",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id=2]
|
||||
radius = 34.9916
|
||||
height = 29.2442
|
||||
|
||||
[node name="Mob" type="RigidBody2D"]
|
||||
collision_mask = 0
|
||||
gravity_scale = 0.0
|
||||
script = ExtResource( 7 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
scale = Vector2( 0.75, 0.75 )
|
||||
frames = SubResource( 1 )
|
||||
animation = "walk"
|
||||
playing = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
rotation = 1.5708
|
||||
shape = SubResource( 2 )
|
||||
|
||||
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
|
@ -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 )
|
|
@ -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
|
|
@ -0,0 +1,94 @@
|
|||
extends Area2D
|
||||
|
||||
enum PlayerState { NORMAL, DASHING, STANDING };
|
||||
enum PlayerDirection { RIGHT, LEFT, DOWN, UP };
|
||||
|
||||
export var speed = 200 # How fast the player will move (pixels/sec).
|
||||
var screen_size # Size of the game window.
|
||||
var state = PlayerState.NORMAL;
|
||||
var direction = PlayerDirection.RIGHT;
|
||||
var last_process_velocity = Vector2()
|
||||
|
||||
func start(pos):
|
||||
position = pos
|
||||
show()
|
||||
|
||||
func _ready():
|
||||
screen_size = get_viewport_rect().size
|
||||
|
||||
func processNormal(delta):
|
||||
var velocity = Vector2() # The player's movement vector.
|
||||
if Input.is_key_pressed(KEY_SHIFT):
|
||||
state = PlayerState.DASHING
|
||||
return
|
||||
|
||||
if Input.is_action_pressed("ui_right"):
|
||||
velocity.x += 1
|
||||
direction = PlayerDirection.RIGHT;
|
||||
if Input.is_action_pressed("ui_left"):
|
||||
velocity.x -= 1
|
||||
direction = PlayerDirection.LEFT;
|
||||
if Input.is_action_pressed("ui_down"):
|
||||
velocity.y += 1
|
||||
direction = PlayerDirection.DOWN;
|
||||
if Input.is_action_pressed("ui_up"):
|
||||
velocity.y -= 1
|
||||
direction = PlayerDirection.UP;
|
||||
if velocity.length() > 0:
|
||||
velocity = velocity.normalized() * speed
|
||||
$AnimatedSprite.play()
|
||||
|
||||
position += velocity * delta
|
||||
position.x = clamp(position.x, 0, screen_size.x)
|
||||
position.y = clamp(position.y, 0, screen_size.y)
|
||||
|
||||
if velocity.x > 0 or velocity.y != 0:
|
||||
$AnimatedSprite.animation = "forward"
|
||||
direction = PlayerDirection.RIGHT;
|
||||
elif velocity.x < 0:
|
||||
$AnimatedSprite.animation = "backward"
|
||||
direction = PlayerDirection.LEFT;
|
||||
else:
|
||||
$AnimatedSprite.animation = "idle"
|
||||
|
||||
last_process_velocity = velocity
|
||||
|
||||
func processDash(delta):
|
||||
$AnimatedSprite.animation = "dash"
|
||||
$AnimatedSprite.speed_scale = 2.5
|
||||
var velocity = last_process_velocity
|
||||
velocity = velocity.normalized() * speed
|
||||
if velocity.length() > 0:
|
||||
velocity = velocity.normalized() * speed
|
||||
$AnimatedSprite.play()
|
||||
position += velocity * delta * 1.8
|
||||
position.x = clamp(position.x, 0, screen_size.x)
|
||||
position.y = clamp(position.y, 0, screen_size.y)
|
||||
$AnimatedSprite.flip_h = velocity.x < 0
|
||||
|
||||
func processStanding(delta):
|
||||
$AnimatedSprite.animation = "standing up"
|
||||
$AnimatedSprite.speed_scale = 1
|
||||
var velocity = Vector2(0.0, 0.0)
|
||||
position += velocity.normalized() * delta
|
||||
position.x = clamp(position.x, 0, screen_size.x)
|
||||
position.y = clamp(position.y, 0, screen_size.y)
|
||||
$AnimatedSprite.flip_h = last_process_velocity.x < 0
|
||||
|
||||
func _process(delta):
|
||||
if state == PlayerState.NORMAL:
|
||||
processNormal(delta)
|
||||
elif state == PlayerState.DASHING:
|
||||
processDash(delta)
|
||||
else:
|
||||
processStanding(delta)
|
||||
|
||||
|
||||
|
||||
func _on_AnimatedSprite_animation_finished():
|
||||
if $AnimatedSprite.animation == "dash": # Replace with function body.
|
||||
state = PlayerState.STANDING
|
||||
$AnimatedSprite.speed_scale = 1
|
||||
elif $AnimatedSprite.animation == "standing up":
|
||||
state = PlayerState.NORMAL
|
||||
$AnimatedSprite.flip_h = false
|
|
@ -0,0 +1,24 @@
|
|||
; 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="core-game"
|
||||
run/main_scene="res://Main.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[rendering]
|
||||
|
||||
environment/default_environment="res://default_env.tres"
|
|
@ -0,0 +1,15 @@
|
|||
extends Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$Label.text = "Press me, senpai!"
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
$Label.text = "HELLO!"
|
||||
$Timer.stop()
|
||||
$Timer.start()
|
||||
|
||||
|
||||
func _on_Timer_timeout():
|
||||
$Label.text = "Press me, senpai!"
|
|
@ -0,0 +1,107 @@
|
|||
[gd_scene load_steps=25 format=2]
|
||||
|
||||
[ext_resource path="res://assets/art/forward-sheet.png" type="Texture" id=1]
|
||||
[ext_resource path="res://assets/art/backwards-sheet.png" type="Texture" id=2]
|
||||
[ext_resource path="res://assets/art/idle-sheet.png" type="Texture" id=3]
|
||||
[ext_resource path="res://assets/art/dash/dash-04.png" type="Texture" id=4]
|
||||
[ext_resource path="res://player.gd" type="Script" id=5]
|
||||
[ext_resource path="res://assets/art/dash/dash-02.png" type="Texture" id=6]
|
||||
[ext_resource path="res://assets/art/dash/dash-06.png" type="Texture" id=7]
|
||||
[ext_resource path="res://assets/art/dash/dash-09.png" type="Texture" id=8]
|
||||
[ext_resource path="res://assets/art/dash/dash-01.png" type="Texture" id=9]
|
||||
[ext_resource path="res://assets/art/dash/dash-05.png" type="Texture" id=10]
|
||||
[ext_resource path="res://assets/art/dash/dash-07.png" type="Texture" id=11]
|
||||
[ext_resource path="res://assets/art/dash/dash-03.png" type="Texture" id=12]
|
||||
[ext_resource path="res://assets/art/dash/dash-08.png" type="Texture" id=13]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=9]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 0, 0, 45, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=10]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 45, 0, 45, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=11]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 90, 0, 45, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=12]
|
||||
flags = 4
|
||||
atlas = ExtResource( 3 )
|
||||
region = Rect2( 135, 0, 45, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=13]
|
||||
flags = 4
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 0, 0, 45, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=14]
|
||||
flags = 4
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 45, 0, 45, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=15]
|
||||
flags = 4
|
||||
atlas = ExtResource( 1 )
|
||||
region = Rect2( 90, 0, 45, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=5]
|
||||
flags = 4
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 0, 0, 44, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=6]
|
||||
flags = 4
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 44, 0, 44, 47 )
|
||||
|
||||
[sub_resource type="AtlasTexture" id=7]
|
||||
flags = 4
|
||||
atlas = ExtResource( 2 )
|
||||
region = Rect2( 88, 0, 44, 47 )
|
||||
|
||||
[sub_resource type="SpriteFrames" id=8]
|
||||
animations = [ {
|
||||
"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
|
||||
"loop": true,
|
||||
"name": "idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 13 ), SubResource( 14 ), SubResource( 15 ) ],
|
||||
"loop": true,
|
||||
"name": "forward",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 9 ), ExtResource( 6 ), ExtResource( 12 ), ExtResource( 4 ), ExtResource( 4 ), ExtResource( 10 ), ExtResource( 7 ), ExtResource( 7 ), ExtResource( 11 ) ],
|
||||
"loop": true,
|
||||
"name": "dash",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
|
||||
"loop": true,
|
||||
"name": "backward",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [ ExtResource( 13 ), ExtResource( 13 ), ExtResource( 8 ) ],
|
||||
"loop": true,
|
||||
"name": "standing up",
|
||||
"speed": 5.0
|
||||
} ]
|
||||
|
||||
[node name="Player" type="Area2D"]
|
||||
script = ExtResource( 5 )
|
||||
__meta__ = {
|
||||
"_edit_group_": true
|
||||
}
|
||||
|
||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
|
||||
frames = SubResource( 8 )
|
||||
animation = "standing up"
|
||||
frame = 1
|
||||
playing = true
|
||||
[connection signal="body_entered" from="." to="." method="_on_Player_body_entered"]
|
||||
[connection signal="animation_finished" from="AnimatedSprite" to="." method="_on_AnimatedSprite_animation_finished"]
|
Loading…
Reference in New Issue