Browse Source

Player gun, bullet and its collisiions. Refactor.

master
Felipe M 10 months ago
parent
commit
ffb7c8bf99
Signed by: fmartingr GPG Key ID: 716BC147715E716F
  1. 3
      metroidvania/DebugKinematicBody2D.gd
  2. 0
      metroidvania/Scenes/Effects/DustEffect.gd
  3. 12
      metroidvania/Scenes/Effects/DustEffect.tscn
  4. 0
      metroidvania/Scenes/Effects/Effect.tscn
  5. 9
      metroidvania/Scenes/Enemies/Enemy.gd
  6. 19
      metroidvania/Scenes/Enemies/Enemy.tscn
  7. 32
      metroidvania/Scenes/Enemies/WalkingEnemy.gd
  8. 79
      metroidvania/Scenes/Enemies/WalkingEnemy.tscn
  9. 0
      metroidvania/Scenes/Objects/Brick.tscn
  10. 9
      metroidvania/Scenes/Objects/Hitbox.gd
  11. 11
      metroidvania/Scenes/Objects/Hitbox.tscn
  12. 5
      metroidvania/Scenes/Objects/Hurtbox.gd
  13. 10
      metroidvania/Scenes/Objects/Hurtbox.tscn
  14. 20
      metroidvania/Scenes/Objects/Proyectile.gd
  15. 20
      metroidvania/Scenes/Objects/Proyectile.tscn
  16. 36
      metroidvania/Scenes/Player/Player.gd
  17. 16
      metroidvania/Scenes/Player/Player.tscn
  18. 5
      metroidvania/Scenes/Player/PlayerBullet.gd
  19. 59
      metroidvania/Scenes/Player/PlayerBullet.tscn
  20. 6
      metroidvania/Scenes/Player/PlayerGun.gd
  21. 15
      metroidvania/Scenes/Player/PlayerGun.tscn
  22. 24
      metroidvania/Scenes/World.tscn
  23. 60
      metroidvania/Scenes/World/MovingPlatform.tscn
  24. 148
      metroidvania/Scenes/World/TileMap.tscn
  25. 0
      metroidvania/Scenes/World/World.gd
  26. 41
      metroidvania/Scenes/World/World.tscn
  27. 8
      metroidvania/Utils.gd
  28. 18
      metroidvania/project.godot

3
metroidvania/DebugKinematicBody2D.gd

@ -1,6 +1,7 @@
extends Line2D
func _physics_process(delta):
func _physics_process(_delta):
var parent = get_parent()
$Motion.points[1].x = parent.motion.x/4
$Motion.points[1].y = parent.motion.y/4

0
metroidvania/DustEffect.gd → metroidvania/Scenes/Effects/DustEffect.gd

12
metroidvania/DustEffect.tscn → metroidvania/Scenes/Effects/DustEffect.tscn

@ -1,8 +1,8 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Assets/Effects/Dust.png" type="Texture" id=1]
[ext_resource path="res://Effect.tscn" type="PackedScene" id=2]
[ext_resource path="res://DustEffect.gd" type="Script" id=3]
[ext_resource path="res://Scenes/Effects/DustEffect.gd" type="Script" id=1]
[ext_resource path="res://Assets/Effects/Dust.png" type="Texture" id=2]
[ext_resource path="res://Scenes/Effects/Effect.tscn" type="PackedScene" id=3]
[sub_resource type="Animation" id=1]
resource_name = "Animate"
@ -32,11 +32,11 @@ tracks/1/keys = {
} ]
}
[node name="DustEffect" instance=ExtResource( 2 )]
script = ExtResource( 3 )
[node name="DustEffect" instance=ExtResource( 3 )]
script = ExtResource( 1 )
[node name="Sprite" parent="." index="0"]
texture = ExtResource( 1 )
texture = ExtResource( 2 )
hframes = 3
frame = 2

0
metroidvania/Effect.tscn → metroidvania/Scenes/Effects/Effect.tscn

9
metroidvania/Scenes/Enemies/Enemy.gd

@ -0,0 +1,9 @@
extends KinematicBody2D
export (int) var MAX_SPEED = 15
var motion = Vector2.ZERO
func _on_Hurtbox_hit(_damage):
queue_free()

19
metroidvania/Scenes/Enemies/Enemy.tscn

@ -0,0 +1,19 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/Enemies/Enemy.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Objects/Hurtbox.tscn" type="PackedScene" id=2]
[node name="Enemy" type="KinematicBody2D"]
collision_layer = 0
collision_mask = 2
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
[node name="Collider" type="CollisionShape2D" parent="."]
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
[node name="Hurtbox" parent="." instance=ExtResource( 2 )]
collision_mask = 8
[connection signal="hit" from="Hurtbox" to="." method="_on_Hurtbox_hit"]

32
metroidvania/Scenes/Enemies/WalkingEnemy.gd

@ -0,0 +1,32 @@
extends "res://Scenes/Enemies/Enemy.gd"
enum DIRECTION {LEFT = -1, RIGHT = 1}
export (DIRECTION) var WALKING_DIRECTION = DIRECTION.RIGHT
var state
onready var sprite = $Sprite
onready var floor_left = $FloorLeft
onready var floor_right = $FloorRight
onready var wall_right = $WallRight
onready var wall_left = $WallLeft
func _ready():
motion.y = 8
state = WALKING_DIRECTION
func _physics_process(_delta):
match state:
DIRECTION.RIGHT:
motion.x = MAX_SPEED
if not floor_right.is_colliding() or wall_right.is_colliding():
state = DIRECTION.LEFT
DIRECTION.LEFT:
motion.x = -MAX_SPEED
if not floor_left.is_colliding() or wall_left.is_colliding():
state = DIRECTION.RIGHT
sprite.scale.x = sign(motion.x)
motion = move_and_slide_with_snap(motion, Vector2.DOWN * 4, Vector2.UP, true, 4, deg2rad(46))

79
metroidvania/Scenes/Enemies/WalkingEnemy.tscn

@ -0,0 +1,79 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Scenes/Enemies/WalkingEnemy.gd" type="Script" id=1]
[ext_resource path="res://Assets/Enemies/WalkingEnemy.png" type="Texture" id=2]
[ext_resource path="res://Scenes/Enemies/Enemy.tscn" type="PackedScene" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 2, 6 )
[sub_resource type="Animation" id=2]
resource_name = "Walking"
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("../WalkingEnemy/Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.5 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 0, 1 ]
}
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 7, 6 )
[node name="WalkingEnemy" instance=ExtResource( 3 )]
script = ExtResource( 1 )
MAX_SPEED = 15
[node name="Sprite" parent="." index="0"]
position = Vector2( 0, -9 )
texture = ExtResource( 2 )
flip_h = true
hframes = 2
[node name="Collider" parent="." index="1"]
position = Vector2( 0, -6 )
shape = SubResource( 1 )
[node name="AnimationPlayer" parent="." index="2"]
autoplay = "Walking"
anims/Walking = SubResource( 2 )
[node name="FloorRight" type="RayCast2D" parent="." index="3"]
position = Vector2( 2, -1 )
enabled = true
cast_to = Vector2( 0, 7 )
collision_mask = 2
[node name="FloorLeft" type="RayCast2D" parent="." index="4"]
position = Vector2( -2, -1 )
enabled = true
cast_to = Vector2( 0, 7 )
collision_mask = 2
[node name="WallRight" type="RayCast2D" parent="." index="5"]
position = Vector2( 0, -8 )
enabled = true
cast_to = Vector2( 6, 0 )
collision_mask = 2
[node name="WallLeft" type="RayCast2D" parent="." index="6"]
position = Vector2( 0, -8 )
enabled = true
cast_to = Vector2( -6, 0 )
collision_mask = 2
[node name="Hurtbox" parent="." index="7"]
collision_layer = 8
collision_mask = 0
[node name="Collider" parent="Hurtbox" index="0"]
position = Vector2( 0, -7 )
shape = SubResource( 3 )
[editable path="Hurtbox"]

0
metroidvania/Scenes/Brick.tscn → metroidvania/Scenes/Objects/Brick.tscn

9
metroidvania/Scenes/Objects/Hitbox.gd

@ -0,0 +1,9 @@
extends Area2D
# Deal damage
export (int) var damage = 1
func _on_Hitbox_area_entered(hurtbox):
hurtbox.emit_signal("hit", damage)

11
metroidvania/Scenes/Objects/Hitbox.tscn

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scenes/Objects/Hitbox.gd" type="Script" id=1]
[node name="Hitbox" type="Area2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource( 1 )
[node name="Collider" type="CollisionShape2D" parent="."]
[connection signal="area_entered" from="." to="." method="_on_Hitbox_area_entered"]

5
metroidvania/Scenes/Objects/Hurtbox.gd

@ -0,0 +1,5 @@
extends Area2D
# Receives damage
signal hit(damage)

10
metroidvania/Scenes/Objects/Hurtbox.tscn

@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Scenes/Objects/Hurtbox.gd" type="Script" id=1]
[node name="Hurtbox" type="Area2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource( 1 )
[node name="Collider" type="CollisionShape2D" parent="."]

20
metroidvania/Scenes/Objects/Proyectile.gd

@ -0,0 +1,20 @@
extends Node2D
var velocity = Vector2.ZERO
func _process(delta):
position += velocity * delta
func _on_VisibilityNotifier2D_viewport_exited(_viewport):
queue_free()
func _on_Hitbox_body_entered(_body):
# When we collide with the world
queue_free()
func _on_Hitbox_area_entered(_area):
# When we collide with an enemy (a hurtbox)
queue_free()

20
metroidvania/Scenes/Objects/Proyectile.tscn

@ -0,0 +1,20 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/Objects/Proyectile.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Objects/Hitbox.tscn" type="PackedScene" id=2]
[node name="Proyectile" type="Node2D"]
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
rect = Rect2( -4, -4, 8, 8 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
[node name="Hitbox" parent="." instance=ExtResource( 2 )]
collision_mask = 2
[connection signal="viewport_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_viewport_exited"]
[connection signal="area_entered" from="Hitbox" to="." method="_on_Hitbox_area_entered"]
[connection signal="body_entered" from="Hitbox" to="." method="_on_Hitbox_body_entered"]

36
metroidvania/Scenes/Player.gd → metroidvania/Scenes/Player/Player.gd

@ -1,6 +1,7 @@
extends KinematicBody2D
const DustEffect = preload("res://DustEffect.tscn")
const DustEffect = preload("res://Scenes/Effects/DustEffect.tscn")
const PlayerBullet = preload("res://Scenes/Player/PlayerBullet.tscn")
export (int) var acceleration = 512
export (int) var max_speed = 64
@ -8,7 +9,8 @@ export (float) var friction = 0.25
export (int) var gravity = 200
export (int) var jump_force = 128
export (int) var max_slope = 46
export (int) var bullet_speed = 250
var motion = Vector2.ZERO
var snap_vector = Vector2.ZERO
var just_jumped= false
@ -16,6 +18,10 @@ var just_jumped= false
onready var sprite = $Sprite
onready var animation = $Animation
onready var coyoteJumpTimer = $CoyoteJumpTimer
onready var playerGun = $Sprite/PlayerGun
onready var muzzle = $Sprite/PlayerGun/Sprite/Muzzle
onready var fireBulletTimer = $FireBulletTimer
func _physics_process(delta):
just_jumped = false
@ -28,12 +34,20 @@ func _physics_process(delta):
update_animations(input_vector)
move()
if Input.is_action_pressed("fire") and fireBulletTimer.time_left == 0:
fire_bullet()
func fire_bullet():
var bullet = Utils.instance_scene_on_main(PlayerBullet, muzzle.global_position)
bullet.velocity = Vector2.RIGHT.rotated(playerGun.rotation) * bullet_speed
bullet.velocity.x *= sprite.scale.x # Flip left/right depending on players direction
bullet.rotation = bullet.velocity.angle()
fireBulletTimer.start()
func create_dust_effect():
var dustPosition = global_position
dustPosition.x += rand_range(-4, 4)
var dustEffect = DustEffect.instance()
dustEffect.global_position = dustPosition
get_tree().current_scene.add_child(dustEffect)
var dust_position = global_position
dust_position.x += rand_range(-4, 4)
Utils.instance_scene_on_main(DustEffect, dust_position)
func get_input_vector():
var input_vector = Vector2.ZERO
@ -69,13 +83,15 @@ func apply_gravity(delta):
motion.y = min(motion.y, jump_force)
func update_animations(input_vector):
sprite.scale.x = sign(get_local_mouse_position().x)
animation.playback_speed = 1
if input_vector.x != 0:
# Reverses the sprite if the direction is -x ?
sprite.scale.x = sign(input_vector.x)
animation.playback_speed = sign(input_vector.x * sprite.scale.x)
animation.play("Run")
else:
animation.play("Idle")
if not is_on_floor():
animation.play("Jump")

16
metroidvania/Scenes/Player.tscn → metroidvania/Scenes/Player/Player.tscn

@ -1,8 +1,11 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=9 format=2]
[ext_resource path="res://Assets/Player/Player.png" type="Texture" id=1]
[ext_resource path="res://Scenes/Player.gd" type="Script" id=2]
[ext_resource path="res://Scenes/Player/Player.gd" type="Script" id=2]
[ext_resource path="res://DebugKinematicBody2D.tscn" type="PackedScene" id=3]
[ext_resource path="res://Scenes/Player/PlayerGun.tscn" type="PackedScene" id=4]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 4, 7 )
@ -75,6 +78,7 @@ tracks/1/keys = {
}
[node name="Player" type="KinematicBody2D"]
collision_mask = 2
script = ExtResource( 2 )
[node name="Sprite" type="Sprite" parent="."]
@ -83,6 +87,10 @@ texture = ExtResource( 1 )
hframes = 12
frame = 4
[node name="PlayerGun" parent="Sprite" instance=ExtResource( 4 )]
show_behind_parent = true
position = Vector2( 1, 3 )
[node name="Collision" type="CollisionShape2D" parent="."]
position = Vector2( 0, -7 )
shape = SubResource( 1 )
@ -103,3 +111,7 @@ update_scale = false
[node name="CoyoteJumpTimer" type="Timer" parent="."]
wait_time = 0.2
one_shot = true
[node name="FireBulletTimer" type="Timer" parent="."]
wait_time = 0.3
one_shot = true

5
metroidvania/Scenes/Player/PlayerBullet.gd

@ -0,0 +1,5 @@
extends "res://Scenes/Objects/Proyectile.gd"
func _ready():
# Do not run _process()
set_process(false)

59
metroidvania/Scenes/Player/PlayerBullet.tscn

@ -0,0 +1,59 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Scenes/Player/PlayerBullet.gd" type="Script" id=1]
[ext_resource path="res://Assets/Player/PlayerBullet.png" type="Texture" id=2]
[ext_resource path="res://Scenes/Objects/Proyectile.tscn" type="PackedScene" id=3]
[sub_resource type="Animation" id=1]
resource_name = "Fire"
length = 0.1
step = 0.05
tracks/0/type = "value"
tracks/0/path = NodePath("Sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.05 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 0, 1 ]
}
tracks/1/type = "method"
tracks/1/path = NodePath(".")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0.05 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ true ],
"method": "set_process"
} ]
}
[sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 4, 2 )
[node name="PlayerBullet" instance=ExtResource( 3 )]
script = ExtResource( 1 )
[node name="Sprite" parent="." index="0"]
texture = ExtResource( 2 )
hframes = 2
frame = 1
[node name="AnimationPlayer" parent="." index="2"]
autoplay = "Fire"
anims/Fire = SubResource( 1 )
[node name="Hitbox" parent="." index="3"]
collision_mask = 10
[node name="Collider" parent="Hitbox" index="0"]
shape = SubResource( 2 )
[editable path="Hitbox"]

6
metroidvania/Scenes/Player/PlayerGun.gd

@ -0,0 +1,6 @@
extends Node2D
func _process(_delta):
var player = get_parent()
rotation = player.get_local_mouse_position().angle()

15
metroidvania/Scenes/Player/PlayerGun.tscn

@ -0,0 +1,15 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Scenes/Player/PlayerGun.gd" type="Script" id=1]
[ext_resource path="res://Assets/Player/PlayerGun.png" type="Texture" id=2]
[node name="PlayerGun" type="Node2D"]
script = ExtResource( 1 )
[node name="Sprite" type="Sprite" parent="."]
position = Vector2( -2, -2 )
texture = ExtResource( 2 )
centered = false
[node name="Muzzle" type="Position2D" parent="Sprite"]
position = Vector2( 13, 2 )

24
metroidvania/Scenes/World.tscn

@ -1,24 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://TileMap.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scenes/World.gd" type="Script" id=3]
[node name="World" type="Node"]
script = ExtResource( 3 )
[node name="Player" parent="." instance=ExtResource( 2 )]
position = Vector2( 32, 96 )
[node name="CameraFollow" parent="Player" index="4"]
remote_path = NodePath("../../Camera")
[node name="Camera" type="Camera2D" parent="."]
position = Vector2( 32, 88 )
current = true
smoothing_enabled = true
[node name="TileMap" parent="." instance=ExtResource( 1 )]
tile_data = PoolIntArray( 65536, 0, 4, 65537, 0, 196609, 65538, 0, 196609, 65539, 0, 196609, 65540, 0, 196609, 65541, 0, 6, 65542, 0, 5, 65543, 0, 196609, 65544, 0, 196609, 65545, 0, 196609, 65546, 0, 6, 65547, 0, 2, 196607, 0, 4, 131072, 0, 196615, 131077, 0, 131072, 131078, 0, 131074, 131082, 0, 65536, 131083, 0, 131077, 131084, 0, 1, 131085, 0, 5, 131086, 0, 196609, 131087, 0, 196609, 131088, 0, 196609, 131089, 0, 196609, 131090, 0, 196609, 131091, 0, 7, 262143, 0, 65539, 196618, 0, 131072, 196619, 0, 131073, 196620, 0, 131073, 196621, 0, 131074, 196627, 0, 196612, 196628, 0, 7, 327679, 0, 65539, 262164, 0, 65539, 393215, 0, 65539, 327700, 0, 65539, 458751, 0, 65539, 393236, 0, 65539, 524287, 0, 65539, 458762, 1, 3, 458763, 1, 4, 458764, 0, 1, 458765, 0, 2, 458771, 0, 196608, 458772, 0, 262151, 589823, 0, 65539, 524294, 1, 0, 524295, 0, 1, 524296, 0, 1, 524297, 0, 1, 524298, 0, 131078, 524299, 0, 65537, 524300, 0, 65537, 524301, 0, 65538, 524308, 0, 65539, 655359, 0, 131076, 589824, 0, 2, 589829, 1, 0, 589830, 1, 1, 589831, 0, 65537, 589832, 0, 65537, 589833, 0, 65537, 589834, 0, 65537, 589835, 0, 65537, 589836, 0, 65537, 589837, 0, 131077, 589838, 0, 1, 589839, 0, 1, 589840, 0, 1, 589841, 0, 2, 589844, 0, 65539, 720895, 0, 65536, 655360, 0, 131077, 655361, 0, 1, 655362, 0, 1, 655363, 0, 1, 655364, 0, 1, 655365, 1, 1, 655366, 0, 65537, 655367, 0, 65537, 655368, 0, 65541, 655369, 0, 131073, 655370, 0, 131073, 655371, 0, 131073, 655372, 0, 65542, 655373, 0, 65537, 655374, 0, 65537, 655375, 0, 65537, 655376, 0, 65537, 655377, 0, 262149, 655378, 0, 196609, 655379, 0, 196609, 655380, 0, 196615, 786431, 0, 131072, 720896, 0, 65542, 720897, 0, 65537, 720898, 0, 65537, 720899, 0, 65537, 720900, 0, 65537, 720901, 0, 65537, 720902, 0, 65537, 720903, 0, 65541, 720904, 0, 131074, 720908, 0, 131072, 720909, 0, 65542, 720910, 0, 65537, 720911, 0, 65537, 720912, 0, 65541, 720913, 0, 131074, 786432, 0, 65536, 786433, 0, 65537, 786434, 0, 65537, 786435, 0, 65537, 786436, 0, 65537, 786437, 0, 65537, 786438, 0, 65541, 786439, 0, 131074, 786445, 0, 131072, 786446, 0, 131073, 786447, 0, 131073, 786448, 0, 131074, 851968, 0, 131072, 851969, 0, 65542, 851970, 0, 65537, 851971, 0, 65537, 851972, 0, 65541, 851973, 0, 131073, 851974, 0, 131074, 917505, 0, 131072, 917506, 0, 131073, 917507, 0, 131073, 917508, 0, 131074 )
[editable path="Player"]

60
metroidvania/Scenes/World/MovingPlatform.tscn

@ -0,0 +1,60 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Assets/World/MovingPlatform.png" type="Texture" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 16, 4 )
[sub_resource type="Curve2D" id=2]
_data = {
"points": PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -32, 0, 0, 0, 0, 0, -64 )
}
[sub_resource type="Animation" id=3]
resource_name = "Loop"
length = 4.0
loop = true
step = 1.0
tracks/0/type = "value"
tracks/0/path = NodePath("Path2D/PathFollow2D:unit_offset")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 2 ),
"transitions": PoolRealArray( -2, -2 ),
"update": 0,
"values": [ 0.0, 1.0 ]
}
[node name="MovingPlatform" type="Node2D"]
__meta__ = {
"_edit_group_": true
}
[node name="KinematicBody2D" type="KinematicBody2D" parent="."]
collision_layer = 2
motion/sync_to_physics = true
[node name="Sprite" type="Sprite" parent="KinematicBody2D"]
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="KinematicBody2D"]
shape = SubResource( 1 )
one_way_collision = true
[node name="Path2D" type="Path2D" parent="."]
curve = SubResource( 2 )
[node name="PathFollow2D" type="PathFollow2D" parent="Path2D"]
rotate = false
loop = false
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Path2D/PathFollow2D"]
remote_path = NodePath("../../../KinematicBody2D")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "Loop"
playback_process_mode = 0
anims/Loop = SubResource( 3 )

148
metroidvania/TileMap.tscn → metroidvania/Scenes/World/TileMap.tscn

@ -3,6 +3,12 @@
[ext_resource path="res://Assets/World/Tileset.png" type="Texture" id=1]
[ext_resource path="res://Assets/World/Slopes.png" type="Texture" id=2]
[sub_resource type="ConvexPolygonShape2D" id=1]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=2]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=3]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
@ -24,6 +30,9 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=9]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=10]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=11]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
@ -136,7 +145,7 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=48]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
points = PoolVector2Array( 0, 16, 16, 0, 16, 16 )
[sub_resource type="ConvexPolygonShape2D" id=49]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
@ -145,33 +154,24 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=51]
points = PoolVector2Array( 0, 16, 16, 0, 16, 16 )
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=52]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=53]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
points = PoolVector2Array( 0, 16, 0, 8, 16, 0, 16, 16 )
[sub_resource type="ConvexPolygonShape2D" id=54]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
points = PoolVector2Array( 0, 16, 16, 8, 16, 16 )
[sub_resource type="ConvexPolygonShape2D" id=55]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=56]
points = PoolVector2Array( 0, 16, 0, 8, 16, 0, 16, 16 )
[sub_resource type="ConvexPolygonShape2D" id=57]
points = PoolVector2Array( 0, 16, 16, 8, 16, 16 )
[sub_resource type="ConvexPolygonShape2D" id=58]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="ConvexPolygonShape2D" id=59]
points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
[sub_resource type="TileSet" id=1]
[sub_resource type="TileSet" id=57]
0/name = "Tileset.png 0"
0/texture = ExtResource( 1 )
0/tex_offset = Vector2( 0, 0 )
@ -191,290 +191,290 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
0/navigation_offset = Vector2( 0, 0 )
0/shape_offset = Vector2( 0, 0 )
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
0/shape = SubResource( 3 )
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( 3 ),
"shape": SubResource( 1 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 4 ),
"shape": SubResource( 2 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 5 ),
"shape": SubResource( 3 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 6 ),
"shape": SubResource( 4 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 7 ),
"shape": SubResource( 5 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 8 ),
"shape": SubResource( 6 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 9 ),
"shape": SubResource( 7 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 11 ),
"shape": SubResource( 8 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 12 ),
"shape": SubResource( 9 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 13 ),
"shape": SubResource( 10 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 14 ),
"shape": SubResource( 11 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 15 ),
"shape": SubResource( 12 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 16 ),
"shape": SubResource( 13 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 17 ),
"shape": SubResource( 14 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 18 ),
"shape": SubResource( 15 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 19 ),
"shape": SubResource( 16 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 20 ),
"shape": SubResource( 17 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 21 ),
"shape": SubResource( 18 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 22 ),
"shape": SubResource( 19 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 1 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 23 ),
"shape": SubResource( 20 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 24 ),
"shape": SubResource( 21 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 25 ),
"shape": SubResource( 22 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 26 ),
"shape": SubResource( 23 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 27 ),
"shape": SubResource( 24 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 28 ),
"shape": SubResource( 25 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 29 ),
"shape": SubResource( 26 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 30 ),
"shape": SubResource( 27 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 31 ),
"shape": SubResource( 28 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 32 ),
"shape": SubResource( 29 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 33 ),
"shape": SubResource( 30 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 10, 2 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 34 ),
"shape": SubResource( 31 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 0, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 35 ),
"shape": SubResource( 32 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 36 ),
"shape": SubResource( 33 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 37 ),
"shape": SubResource( 34 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 38 ),
"shape": SubResource( 35 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 39 ),
"shape": SubResource( 36 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 40 ),
"shape": SubResource( 37 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 41 ),
"shape": SubResource( 38 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 42 ),
"shape": SubResource( 39 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 43 ),
"shape": SubResource( 40 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 9, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 44 ),
"shape": SubResource( 41 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 10, 3 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 45 ),
"shape": SubResource( 42 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 46 ),
"shape": SubResource( 43 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 47 ),
"shape": SubResource( 44 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 48 ),
"shape": SubResource( 45 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 7, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 49 ),
"shape": SubResource( 46 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 8, 4 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 50 ),
"shape": SubResource( 47 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
0/z_index = 0
@ -495,67 +495,69 @@ points = PoolVector2Array( 0, 0, 16, 0, 16, 16, 0, 16 )
1/navigation_offset = Vector2( 0, 0 )
1/shape_offset = Vector2( 0, 0 )
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
1/shape = SubResource( 51 )
1/shape = SubResource( 48 )
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( 51 ),
"shape": SubResource( 48 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 52 ),
"shape": SubResource( 49 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 1, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 53 ),
"shape": SubResource( 50 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 54 ),
"shape": SubResource( 51 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 5, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 55 ),
"shape": SubResource( 52 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 4, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 56 ),
"shape": SubResource( 53 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 3, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 57 ),
"shape": SubResource( 54 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 2, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 58 ),
"shape": SubResource( 55 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
}, {
"autotile_coord": Vector2( 6, 0 ),
"one_way": false,
"one_way_margin": 1.0,
"shape": SubResource( 59 ),
"shape": SubResource( 56 ),
"shape_transform": Transform2D( 1, 0, 0, 1, 0, 0 )
} ]
1/z_index = 0
[node name="TileMap" type="TileMap"]
tile_set = SubResource( 1 )
tile_set = SubResource( 57 )
cell_size = Vector2( 16, 16 )
collision_layer = 2
collision_mask = 0
format = 1

0
metroidvania/Scenes/World.gd → metroidvania/Scenes/World/World.gd

41
metroidvania/Scenes/World/World.tscn

@ -0,0 +1,41 @@
[gd_scene load_steps=6 format=2]
[ext_resource path="res://Scenes/World/TileMap.tscn" type="PackedScene" id=1]
[ext_resource path="res://Scenes/Player/Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Scenes/World/World.gd" type="Script" id=3]
[ext_resource path="res://Scenes/World/MovingPlatform.tscn" type="PackedScene" id=4]
[ext_resource path="res://Scenes/Enemies/WalkingEnemy.tscn" type="PackedScene" id=5]
[node name="World" type="Node"]
script = ExtResource( 3 )
[node name="Player" parent="." instance=ExtResource( 2 )]
position = Vector2( 9, 96 )
[node name="CameraFollow" parent="Player" index="4"]
remote_path = NodePath("../../Camera")
[node name="Camera" type="Camera2D" parent="."]
position = Vector2( 9, 88 )
current = true
smoothing_enabled = true
[node name="TileMap" parent="." instance=ExtResource( 1 )]
tile_data = PoolIntArray( 18, 0, 0, 19, 0, 5, 20, 0, 196609, 21, 0, 196609, 22, 0, 196609, 23, 0, 196609, 24, 0, 196609, 25, 0, 196609, 26, 0, 196609, 27, 0, 196609, 28, 0, 196609, 29, 0, 196609, 30, 0, 196609, 31, 0, 196609, 32, 0, 196609, 33, 0, 196609, 34, 0, 196609, 35, 0, 196609, 36, 0, 196609, 37, 0, 196609, 38, 0, 196609, 39, 0, 196609, 40, 0, 7, 65536, 0, 4, 65537, 0, 196609, 65538, 0, 196609, 65539, 0, 196609, 65540, 0, 196609, 65541, 0, 6, 65542, 0, 5, 65543, 0, 196609, 65544, 0, 196609, 65545, 0, 196609, 65546, 0, 6, 65547, 0, 2, 65554, 0, 65536, 65555, 0, 65538, 65576, 0, 65539, 196607, 0, 4, 131072, 0, 196615, 131077, 0, 131072, 131078, 0, 131074, 131082, 0, 65536, 131083, 0, 131077, 131084, 0, 1, 131085, 0, 5, 131086, 0, 196609, 131087, 0, 196609, 131088, 0, 196609, 131089, 0, 196609, 131090, 0, 196614, 131091, 0, 131074, 131112, 0, 65539, 262143, 0, 65539, 196618, 0, 131072, 196619, 0, 131073, 196620, 0, 131073, 196621, 0, 131074, 196648, 0, 65539, 327679, 0, 65539, 262184, 0, 65539, 393215, 0, 65539, 327705, 1, 3, 327706, 1, 4, 327707, 0, 1, 327708, 0, 1, 327709, 0, 1, 327710, 0, 1, 327711, 536870913, 4, 327712, 536870913, 3, 327720, 0, 65539, 458751, 0, 65539, 393238, 1, 0, 393239, 0, 1, 393240, 0, 1, 393241, 1, 5, 393242, 536870912, 65537, 393243, 536870912, 65537, 393244, 536870912, 65537, 393245, 536870912, 65537, 393246, 536870912, 65537, 393247, 536870912, 65537, 393248, 536870913, 5, 393249, 536870912, 1, 393250, 536870912, 1, 393251, 536870913, 0, 393256, 0, 65539, 524287, 0, 65539, 458762, 1, 3, 458763, 1, 4, 458764, 0, 1, 458765, 0, 2, 458773, 1, 0, 458774, 1, 1, 458775, 536870912, 65537, 458776, 536870912, 65537, 458777, 536870912, 65537, 458778, 536870912, 65537, 458779, 536870912, 65537, 458780, 536870912, 65537, 458781, 536870912, 65537, 458782, 536870912, 65537, 458783, 536870912, 65537, 458784, 536870912, 65537, 458785, 536870912, 65537, 458786, 536870912, 65537, 458787, 536870913, 1, 458788, 536870913, 0, 458792, 0, 65539, 589823, 0, 65539, 524294, 1, 0, 524295, 0, 1, 524296, 0, 1, 524297, 0, 1, 524298, 0, 131078, 524299, 0, 65537, 524300, 0, 65537, 524301, 0, 131077, 524302, 0, 1, 524303, 0, 1, 524304, 0, 1, 524305, 0, 1, 524306, 0, 1, 524307, 0, 1, 524308, 0, 2, 524309, 1, 2, 524310, 536870912, 131073, 524311, 536870912, 131073, 524312, 536870912, 131073, 524313, 536870912, 131073, 524314, 536870912, 131073, 524315, 536870912, 131073, 524316, 536870912, 131073, 524317, 536870912, 131073, 524318, 536870912, 131073, 524319, 536870912, 131073, 524320, 536870912, 131073, 524321, 536870912, 131073, 524322, 536870912, 131073, 524323, 536870912, 131073, 524324, 536870913, 2, 524325, 0, 196609, 524326, 0, 196609, 524327, 0, 196609, 524328, 0, 196615, 655359, 0, 131076, 589824, 0, 2, 589829, 1, 0, 589830, 1, 1, 589831, 0, 65537, 589832, 0, 65537, 589833, 0, 65537, 589834, 0, 65537, 589835, 0, 65537, 589836, 0, 65537, 589837, 0, 65537, 589838, 0, 65537, 589839, 0, 65537, 589840, 0, 65537, 589841, 0, 65537, 589842, 0, 65537, 589843, 0, 65537, 589844, 0, 65538, 720895, 0, 65536, 655360, 0, 131077, 655361, 0, 1, 655362, 0, 1, 655363, 0, 1, 655364, 0, 1, 655365, 1, 1, 655366, 0, 65537, 655367, 0, 65537, 655368, 0, 65541, 655369, 0, 131073, 655370, 0, 131073, 655371, 0, 131073, 655372, 0, 65542, 655373, 0, 65537, 655374, 0, 65537, 655375, 0, 65537, 655376, 0, 65537, 655377, 0, 65541, 655378, 0, 131073, 655379, 0, 131073, 655380, 0, 131074, 786431, 0, 131072, 720896, 0, 65542, 720897, 0, 65537, 720898, 0, 65537, 720899, 0, 65537, 720900, 0, 65537, 720901, 0, 65537, 720902, 0, 65537, 720903, 0, 65541, 720904, 0, 131074, 720908, 0, 131072, 720909, 0, 65542, 720910, 0, 65537, 720911, 0, 65537, 720912, 0, 65541, 720913, 0, 131074, 786432, 0, 65536, 786433, 0, 65537, 786434, 0, 65537, 786435, 0, 65537, 786436, 0, 65537, 786437, 0, 65537, 786438, 0, 65537, 786439, 0, 65538, 786445, 0, 65536, 786446, 0, 65541, 786447, 0, 131073, 786448, 0, 131074, 851968, 0, 131072, 851969, 0, 65542, 851970, 0, 65537, 851971, 0, 65537, 851972, 0, 65541, 851973, 0, 131073, 851974, 0, 131073, 851975, 0, 196613, 851976, 0, 196609, 851977, 0, 196609, 851978, 0, 196609, 851979, 0, 196609, 851980, 0, 196609, 851981, 0, 196614, 851982, 0, 131074, 917505, 0, 131072, 917506, 0, 131073, 917507, 0, 131073, 917508, 0, 131074 )
[node name="MovingPlatform" parent="TileMap" instance=ExtResource( 4 )]
position = Vector2( 64, 128 )
[node name="WalkingEnemy" parent="." instance=ExtResource( 5 )]
position = Vector2( 32, 160 )
[node name="WalkingEnemy2" parent="." instance=ExtResource( 5 )]
position = Vector2( 144, 208 )
[node name="WalkingEnemy3" parent="." instance=ExtResource( 5 )]
position = Vector2( 208, 96 )
[node name="WalkingEnemy4" parent="." instance=ExtResource( 5 )]
position = Vector2( 320, 128 )
[editable path="Player"]

8
metroidvania/Utils.gd

@ -0,0 +1,8 @@
extends Node
func instance_scene_on_main(scene, position):
var main = get_tree().current_scene
var instance = scene.instance()
main.add_child(instance)
instance.global_position = position
return instance

18
metroidvania/project.godot

@ -16,9 +16,13 @@ _global_script_class_icons={
[application]
config/name="Metroidvania"
run/main_scene="res://Scenes/World.tscn"
run/main_scene="res://Scenes/World/World.tscn"
config/icon="res://icon.png"
[autoload]
Utils="*res://Utils.gd"
[display]
window/size/width=320
@ -82,6 +86,18 @@ ui_down={
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null)
]
}
fire={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
]
}
[layer_names]
2d_physics/layer_1="Player"
2d_physics/layer_2="World"
2d_physics/layer_3="PlayerHurtbox"
2d_physics/layer_4="EnemyHurtbox"
[rendering]

Loading…
Cancel
Save