Started work on gravity flipping.
This commit is contained in:
parent
3e1f962a7c
commit
dded4b3043
6 changed files with 43 additions and 14 deletions
|
|
@ -1,15 +1,15 @@
|
|||
[gd_scene load_steps=4 format=4 uid="uid://c6aveiahox475"]
|
||||
[gd_scene format=4 uid="uid://c6aveiahox475"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bdoa8j4vedy8" path="res://Scripts/Levels/level_1.gd" id="1_3mqfk"]
|
||||
[ext_resource type="TileSet" uid="uid://bxbrytgrtnaie" path="res://Sprites/Tile Sets/main.tres" id="2_iixi8"]
|
||||
[ext_resource type="PackedScene" uid="uid://syx6ov00a585" path="res://Scenes/player.tscn" id="3_cyadu"]
|
||||
|
||||
[node name="Main" type="Node2D"]
|
||||
[node name="Main" type="Node2D" unique_id=1619381795]
|
||||
script = ExtResource("1_3mqfk")
|
||||
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="."]
|
||||
[node name="TileMapLayer" type="TileMapLayer" parent="." unique_id=816172969]
|
||||
tile_map_data = PackedByteArray("AAABAAwAAAAAAAEAAAACAAwAAAAAAAEAAAADAAwAAAAAAAEAAAAEAAwAAAAAAAEAAAAFAAwAAAAAAAEAAAAGAAwAAAAAAAEAAAAHAAwAAAAAAAEAAAAIAAwAAAAAAAEAAAAJAAwAAAAAAAEAAAAKAAwAAAAAAAEAAAALAAwAAAAAAAEAAAAMAAwAAAAAAAEAAAANAAwAAAAAAAEAAAAOAAwAAAAAAAEAAAAPAAwAAAAAAAEAAAAQAAwAAAAAAAEAAAARAAwAAAAAAAEAAAASAAwAAAAAAAEAAAATAAwAAAAAAAEAAAAUAAwAAAAAAAEAAAAVAAwAAAAAAAEAAAAWAAwAAAAAAAEAAAAXAAwAAAAAAAEAAAAYAAwAAAAAAAEAAAAYAAsAAAACAAAAAAA=")
|
||||
tile_set = ExtResource("2_iixi8")
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("3_cyadu")]
|
||||
[node name="Player" parent="." unique_id=798647512 instance=ExtResource("3_cyadu")]
|
||||
position = Vector2(24, 184)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
18
Scenes/main.tscn884110510.tmp
Normal file
18
Scenes/main.tscn884110510.tmp
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://syx6ov00a585"]
|
||||
[gd_scene format=3 uid="uid://syx6ov00a585"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://ohb2t6o7wr1u" path="res://Scripts/player.gd" id="1_cvnsp"]
|
||||
[ext_resource type="Texture2D" uid="uid://btqnhg54e1p66" path="res://Sprites/png/spritesheet.png" id="2_6t5aa"]
|
||||
|
|
@ -9,31 +9,32 @@
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jjgbg"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
[node name="Player" type="CharacterBody2D" unique_id=164762863]
|
||||
script = ExtResource("1_cvnsp")
|
||||
|
||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="."]
|
||||
[node name="GPUParticles2D" type="GPUParticles2D" parent="." unique_id=756960656]
|
||||
emitting = false
|
||||
amount = 100
|
||||
lifetime = 3.3699999999999997
|
||||
process_material = ExtResource("2_vgqql")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
[node name="Sprite" type="Sprite2D" parent="." unique_id=1999170828]
|
||||
texture = ExtResource("2_6t5aa")
|
||||
hframes = 3
|
||||
vframes = 3
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=621110541]
|
||||
shape = SubResource("RectangleShape2D_jjgbg")
|
||||
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." unique_id=1812533245]
|
||||
rect = Rect2(-8, -8, 16, 16)
|
||||
|
||||
[node name="Camera" type="Camera2D" parent="."]
|
||||
[node name="Camera" type="Camera2D" parent="." unique_id=497505403]
|
||||
top_level = true
|
||||
ignore_rotation = false
|
||||
script = ExtResource("4_vgqql")
|
||||
|
||||
[node name="SceneTransitionRect" parent="." instance=ExtResource("5_fkybt")]
|
||||
[node name="SceneTransitionRect" parent="." unique_id=1947015698 instance=ExtResource("5_fkybt")]
|
||||
offset_left = -5000.0
|
||||
offset_top = -5000.0
|
||||
offset_right = 5000.0
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ extends CharacterBody2D
|
|||
@onready var particles : GPUParticles2D = $GPUParticles2D #The particles of the player.
|
||||
@onready var transition_rect : ColorRect = $SceneTransitionRect #The white rectangle used for fading in and out.
|
||||
@onready var transition_anim : AnimationPlayer = $SceneTransitionRect/AnimationPlayer #The animation player attached to the transition rectangle.
|
||||
@onready var attached_camera : Camera2D = $Camera
|
||||
|
||||
@export_category("Movement")
|
||||
@export var acceleration : float = 50
|
||||
|
|
@ -12,6 +13,7 @@ extends CharacterBody2D
|
|||
@export var move_speed : float = 100
|
||||
|
||||
var move_input : float
|
||||
var target_rotation : float = 0.0
|
||||
var dead : bool
|
||||
|
||||
func _ready() -> void:
|
||||
|
|
@ -47,6 +49,9 @@ func _physics_process(delta: float) -> void:
|
|||
else:
|
||||
particles.emitting = false
|
||||
|
||||
if (current_level.rotation != target_rotation):
|
||||
current_level.rotation = lerp(current_level.rotation, target_rotation, 0.01 * delta)
|
||||
|
||||
move_and_slide() #Allow physics control.
|
||||
tilemap_detection() #Checks for tiles with the "Spike" custom data enabled.
|
||||
|
||||
|
|
@ -73,7 +78,7 @@ func tilemap_detection() -> void:
|
|||
|
||||
var left_grav_data = tile_data.get_custom_data("left_grav")
|
||||
if left_grav_data:
|
||||
al_globals.x_gravity = al_globals.gravity * -5
|
||||
target_rotation = -90
|
||||
|
||||
var right_grav_data = tile_data.get_custom_data("right_grav")
|
||||
if right_grav_data:
|
||||
|
|
|
|||
|
|
@ -12,4 +12,6 @@ func _ready() -> void:
|
|||
func _physics_process(delta: float) -> void:
|
||||
position.x = lerp(position.x, player.position.x, camera_speed * delta)
|
||||
position.y = lerp(position.y, player.position.y, camera_speed * delta)
|
||||
|
||||
rotation = player.rotation
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue