very good progress, next up: tripping and starting the game
This commit is contained in:
parent
8be34b6c12
commit
f16d046a6c
14 changed files with 206 additions and 19 deletions
12
games/platformer/event.tscn
Normal file
12
games/platformer/event.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bgpoql6pt8pph"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://xt8j1hudv1kh" path="res://games/platformer/talky.gd" id="1_hssep"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gqvfi"]
|
||||
size = Vector2(100, 20)
|
||||
|
||||
[node name="Event" type="Area2D"]
|
||||
script = ExtResource("1_hssep")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_gqvfi")
|
||||
|
|
@ -1,12 +1,14 @@
|
|||
[gd_scene load_steps=17 format=4 uid="uid://ckbyiwy0dxbsd"]
|
||||
[gd_scene load_steps=20 format=4 uid="uid://ckbyiwy0dxbsd"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dqyddqx8xm0gw" path="res://games/platformer/player.gd" id="1_1wj3w"]
|
||||
[ext_resource type="Texture2D" uid="uid://diilj7xuttpqu" path="res://icon.svg" id="1_oyf6i"]
|
||||
[ext_resource type="Texture2D" uid="uid://baf30tscdkl0i" path="res://sprites/tv_remote.png" id="2_7eu3u"]
|
||||
[ext_resource type="Texture2D" uid="uid://g5arxk4po7kw" path="res://sprites/platformer_lab_tile.png" id="3_84mot"]
|
||||
[ext_resource type="Texture2D" uid="uid://d1mo5ecyjgngw" path="res://sprites/platformer_stone_tile.png" id="4_86tx6"]
|
||||
[ext_resource type="PackedScene" uid="uid://q3wdnawp7n63" path="res://games/platformer/lab_platform.tscn" id="4_w58m1"]
|
||||
[ext_resource type="Script" uid="uid://43jxroyergh0" path="res://games/platformer/platformerCam.gd" id="5_x2rtd"]
|
||||
[ext_resource type="Texture2D" uid="uid://dyjxtuapxfiip" path="res://sprites/box.png" id="6_02uuf"]
|
||||
[ext_resource type="PackedScene" uid="uid://bgpoql6pt8pph" path="res://games/platformer/event.tscn" id="8_gqvfi"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_1wj3w"]
|
||||
offsets = PackedFloat32Array(0.0209205, 1)
|
||||
|
|
@ -45,6 +47,9 @@ sources/1 = SubResource("TileSetAtlasSource_gqvfi")
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_86tx6"]
|
||||
size = Vector2(32, 32)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_7eu3u"]
|
||||
size = Vector2(20, 150)
|
||||
|
||||
[node name="Platformer" type="Node"]
|
||||
|
||||
[node name="Parallax2D" type="Parallax2D" parent="."]
|
||||
|
|
@ -65,6 +70,7 @@ texture = SubResource("GradientTexture2D_84mot")
|
|||
[node name="Player" type="CharacterBody2D" parent="."]
|
||||
position = Vector2(-1552, -504)
|
||||
script = ExtResource("1_1wj3w")
|
||||
remote_sprite = ExtResource("2_7eu3u")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Player"]
|
||||
scale = Vector2(0.25, 0.25)
|
||||
|
|
@ -117,4 +123,25 @@ texture = ExtResource("6_02uuf")
|
|||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Box"]
|
||||
shape = SubResource("RectangleShape2D_86tx6")
|
||||
|
||||
[node name="Event" parent="." instance=ExtResource("8_gqvfi")]
|
||||
position = Vector2(-1552, -472)
|
||||
text = "Aha, I've finaly found a way in! Now time to find some treasure from this abandoned lab..."
|
||||
|
||||
[node name="Event2" parent="." instance=ExtResource("8_gqvfi")]
|
||||
position = Vector2(-856, 240)
|
||||
rotation = 1.57079
|
||||
text = "Ooh that looks interesting..."
|
||||
|
||||
[node name="Zoomer" type="Area2D" parent="."]
|
||||
position = Vector2(-368, 208)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Zoomer"]
|
||||
shape = SubResource("RectangleShape2D_7eu3u")
|
||||
|
||||
[node name="TheBitWhereYouTrip" type="Area2D" parent="."]
|
||||
position = Vector2(32, 248)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TheBitWhereYouTrip"]
|
||||
shape = SubResource("RectangleShape2D_7eu3u")
|
||||
|
||||
[connection signal="area_entered" from="Player/hitbox" to="Player" method="_on_hitbox_area_entered"]
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ signal remote_get
|
|||
|
||||
@export var SPEED = 200.0
|
||||
@export var JUMP_VELOCITY = -450.0
|
||||
@export var remote_sprite : Texture
|
||||
var controls_enabled : bool = true
|
||||
|
||||
func _ready() -> void:
|
||||
GameManager.allow_movement.connect(change_player_movement)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
|
|
@ -13,6 +16,7 @@ func _process(delta: float) -> void:
|
|||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta
|
||||
|
||||
|
||||
if(controls_enabled):
|
||||
# Handle jump.
|
||||
if Input.is_action_just_pressed("platformer_jump") and is_on_floor():
|
||||
|
|
@ -25,6 +29,8 @@ func _process(delta: float) -> void:
|
|||
velocity.x = direction * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
|
||||
move_and_slide()
|
||||
|
||||
|
|
@ -32,8 +38,28 @@ func _process(delta: float) -> void:
|
|||
func _on_hitbox_area_entered(area: Area2D) -> void:
|
||||
#print(area.name)
|
||||
if(area.name == "Box"):
|
||||
#GameManager.play_zoom_out()
|
||||
area.monitoring = false
|
||||
GameManager.show_item("TV Remote", remote_sprite)
|
||||
GameManager.show_chat("Wonder what i can do with this")
|
||||
if(is_instance_of(area,Event)):
|
||||
#GameManager.play_zoom_out()
|
||||
area.monitoring = false
|
||||
if(area.type == Event.Type.Chat):
|
||||
GameManager.show_chat(area.text)
|
||||
elif(area.type == Event.Type.Item):
|
||||
GameManager.show_item(area.text, area.texture)
|
||||
|
||||
if(area.name == "Zoomer"):
|
||||
GameManager.play_zoom_out()
|
||||
GameManager.show_chat("I guess it did something..?")
|
||||
#GameManager.play_zoom_out()
|
||||
|
||||
#box event
|
||||
#laser event
|
||||
#sticky tape event
|
||||
pass # Replace with function body.
|
||||
|
||||
func change_player_movement(state : bool):
|
||||
#print(state) #im an idiot :3
|
||||
controls_enabled = state
|
||||
|
|
|
|||
20
games/platformer/talky.gd
Normal file
20
games/platformer/talky.gd
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
extends Area2D
|
||||
class_name Event
|
||||
|
||||
enum Type{
|
||||
Chat,
|
||||
Item
|
||||
}
|
||||
|
||||
@export var type : Type
|
||||
@export_multiline var text : String
|
||||
@export var texture : Texture
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
1
games/platformer/talky.gd.uid
Normal file
1
games/platformer/talky.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://xt8j1hudv1kh
|
||||
Loading…
Add table
Add a link
Reference in a new issue