Author SHA1 Message Date
Gary Wang e03b521eef jump dust test, not very happy about the result 2020-11-24 23:16:32 +08:00
4 changed files with 42 additions and 53 deletions

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
[gd_scene load_steps=3 format=2]
[sub_resource type="Curve" id=1]
max_value = 100.0
_data = [ Vector2( 0, 83.5227 ), 0.0, -189.877, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]
[sub_resource type="Gradient" id=2]
offsets = PoolRealArray( 0, 0.718841, 1 )
colors = PoolColorArray( 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 )
[node name="CPUParticles2D" type="CPUParticles2D"]
emitting = false
amount = 35
lifetime = 0.25
one_shot = true
explosiveness = 1.0
lifetime_randomness = 0.2
local_coords = false
emission_shape = 2
emission_rect_extents = Vector2( 3, 0 )
direction = Vector2( 0, -1 )
spread = 6.0
gravity = Vector2( 0, 0 )
initial_velocity = 20.0
initial_velocity_random = 0.1
linear_accel = -50.0
linear_accel_random = 1.0
radial_accel = 2.0
radial_accel_random = 0.5
damping = 25.0
damping_random = 1.0
damping_curve = SubResource( 1 )
color_ramp = SubResource( 2 )
+3 -31
View File
@@ -30,8 +30,7 @@ var var_jump = 0
onready var sprite = $Sprite onready var sprite = $Sprite
onready var camera = $Camera2D onready var jump_dust = $JumpDust
onready var area_camera = $AreaCamera2D
func _physics_process(delta): func _physics_process(delta):
@@ -57,6 +56,8 @@ func _physics_process(delta):
coyote_jump_grace = 0 coyote_jump_grace = 0
var_jump = VAR_JUMP_TIME var_jump = VAR_JUMP_TIME
speed.y = JUMP_SPEED speed.y = JUMP_SPEED
if on_ground:
jump_dust.emitting = true
else: else:
# Gravity # Gravity
var mult = 1 var mult = 1
@@ -85,32 +86,3 @@ func _physics_process(delta):
# Apply movement # Apply movement
speed = move_and_slide(speed, Vector2.UP) speed = move_and_slide(speed, Vector2.UP)
func _on_CameraLimitArea_body_shape_entered(body_id, body, body_shape, area_shape):
if body is TileMap:
return
var body_shape_owner_id = body.shape_find_owner(body_shape)
var body_shape_owner = body.shape_owner_get_owner(body_shape_owner_id)
var body_shape_2d = body.shape_owner_get_shape(body_shape_owner_id, 0)
var body_global_transform = body_shape_owner.global_transform
var area_shape_owner_id = shape_find_owner(area_shape)
var area_shape_owner = shape_owner_get_owner(area_shape_owner_id)
var area_shape_2d = shape_owner_get_shape(area_shape_owner_id, 0)
var area_global_transform = area_shape_owner.global_transform
var collision_points = area_shape_2d.collide_and_get_contacts(area_global_transform,
body_shape_2d,
body_global_transform)
print(body_shape_2d.extents, area_shape_2d.extents)
area_camera.limit_left = 0
area_camera.limit_top = 0
area_camera.limit_right = 320
area_camera.limit_bottom = 176
area_camera.make_current()
print(area_global_transform.x.x, area_global_transform.y.y, area_global_transform.y.x, area_global_transform.x.y)
func _on_CameraLimitArea_body_shape_exited(body_id, body, body_shape, area_shape):
camera.make_current()
+4 -1
View File
@@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://Assets/Player/player.png" type="Texture" id=1] [ext_resource path="res://Assets/Player/player.png" type="Texture" id=1]
[ext_resource path="res://Player.gd" type="Script" id=2] [ext_resource path="res://Player.gd" type="Script" id=2]
[ext_resource path="res://JumpDust.tscn" type="PackedScene" id=3]
[sub_resource type="RectangleShape2D" id=1] [sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 3, 8 ) extents = Vector2( 3, 8 )
@@ -16,3 +17,5 @@ texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -8 ) position = Vector2( 0, -8 )
shape = SubResource( 1 ) shape = SubResource( 1 )
[node name="JumpDust" parent="." instance=ExtResource( 3 )]
+2 -21
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=66 format=2] [gd_scene load_steps=65 format=2]
[ext_resource path="res://Player.tscn" type="PackedScene" id=1] [ext_resource path="res://Player.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/Tilesets/template.png" type="Texture" id=2] [ext_resource path="res://Assets/Tilesets/template.png" type="Texture" id=2]
@@ -578,32 +578,13 @@ points = PoolVector2Array( 0, 0, 8, 0, 8, 8, 0, 8 )
} ] } ]
0/z_index = 0 0/z_index = 0
[sub_resource type="RectangleShape2D" id=63]
extents = Vector2( 160, 88 )
[node name="World" type="Node2D"] [node name="World" type="Node2D"]
[node name="Player" parent="." instance=ExtResource( 1 )] [node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 120.764, 151.995 ) position = Vector2( 120.764, 151.995 )
[node name="Camera2D" type="Camera2D" parent="Player"]
current = true
limit_smoothed = true
smoothing_enabled = true
[node name="AreaCamera2D" type="Camera2D" parent="Player"]
smoothing_enabled = true
[node name="TileMap" type="TileMap" parent="."] [node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource( 62 ) tile_set = SubResource( 62 )
cell_size = Vector2( 8, 8 ) cell_size = Vector2( 8, 8 )
format = 1 format = 1
tile_data = PoolIntArray( -393216, 0, 393218, -327680, 0, 327680, -327641, 0, 393216, -262144, 0, 327683, -262105, 0, 327683, -196608, 0, 327682, -196569, 0, 327681, -131072, 0, 327682, -131033, 0, 327681, -65536, 0, 327681, -65497, 0, 327682, 0, 0, 327683, 39, 0, 327680, 65536, 0, 327680, 65575, 0, 327681, 131072, 0, 327681, 131111, 0, 327682, 196608, 0, 327683, 196622, 0, 524291, 196623, 0, 262145, 196624, 0, 262145, 196625, 0, 589827, 196630, 0, 524289, 196631, 0, 262145, 196632, 0, 262145, 196633, 0, 589825, 196647, 0, 327682, 262144, 0, 131075, 262145, 0, 262145, 262146, 0, 3, 262147, 0, 262147, 262148, 0, 786434, 262152, 0, 720896, 262153, 0, 786432, 262183, 0, 327683, 327680, 0, 327681, 327682, 0, 327682, 327684, 0, 327682, 327688, 0, 131072, 327689, 0, 196608, 327708, 0, 524288, 327709, 0, 262146, 327710, 0, 262145, 327711, 0, 589825, 327719, 0, 327680, 393216, 0, 327680, 393218, 0, 327680, 393220, 0, 327683, 393224, 0, 131072, 393225, 0, 196608, 393255, 0, 327680, 458752, 0, 327682, 458754, 0, 327683, 458756, 0, 327683, 458760, 0, 131072, 458761, 0, 196608, 458791, 0, 327683, 458810, 0, 524291, 458811, 0, 786435, 524288, 0, 327681, 524290, 0, 851971, 524291, 0, 262144, 524292, 0, 196611, 524296, 0, 131072, 524297, 0, 196608, 524327, 0, 327682, 524347, 0, 327681, 589824, 0, 327682, 589828, 0, 327683, 589832, 0, 131072, 589833, 0, 196608, 589857, 0, 524288, 589858, 0, 262147, 589859, 0, 589827, 589863, 0, 327683, 589883, 0, 327681, 655360, 0, 327681, 655362, 0, 393217, 655364, 0, 327680, 655368, 0, 131072, 655369, 0, 196608, 655399, 0, 327680, 655419, 0, 327681, 720896, 0, 327681, 720898, 0, 851970, 720899, 0, 262144, 720900, 0, 196611, 720904, 0, 131072, 720905, 0, 196608, 720935, 0, 327680, 720955, 0, 327680, 786432, 0, 327681, 786436, 0, 327682, 786440, 0, 131072, 786441, 0, 196608, 786471, 0, 327683, 786491, 0, 327680, 851968, 0, 327680, 851970, 0, 720898, 851971, 0, 262144, 851972, 0, 196611, 851976, 0, 131072, 851977, 0, 196608, 852001, 0, 524289, 852002, 0, 262147, 852003, 0, 262145, 852004, 0, 262146, 852005, 0, 262145, 852006, 0, 262146, 852007, 0, 196611, 852027, 0, 327682, 917504, 0, 327681, 917506, 0, 327681, 917508, 0, 327682, 917512, 0, 131072, 917513, 0, 196608, 917543, 0, 327681, 917563, 0, 327681, 983040, 0, 131075, 983041, 0, 262146, 983042, 0, 65539, 983043, 0, 262146, 983044, 0, 917506, 983048, 0, 851969, 983049, 0, 917504, 983079, 0, 327680, 983099, 0, 327682, 1048576, 0, 327681, 1048602, 0, 524291, 1048603, 0, 262144, 1048604, 0, 262146, 1048605, 0, 262146, 1048606, 0, 589826, 1048615, 0, 458755, 1048635, 0, 327682, 1114112, 0, 327681, 1114171, 0, 327683, 1179648, 0, 327683, 1179707, 0, 327682, 1245184, 0, 327680, 1245243, 0, 327680, 1310720, 0, 131074, 1310721, 0, 0, 1310722, 0, 0, 1310723, 0, 0, 1310724, 0, 0, 1310725, 0, 0, 1310726, 0, 0, 1310727, 0, 0, 1310728, 0, 0, 1310729, 0, 0, 1310730, 0, 0, 1310731, 0, 0, 1310732, 0, 0, 1310733, 0, 0, 1310734, 0, 0, 1310735, 0, 0, 1310736, 0, 0, 1310737, 0, 0, 1310738, 0, 0, 1310739, 0, 0, 1310740, 0, 0, 1310741, 0, 0, 1310742, 0, 0, 1310743, 0, 0, 1310744, 0, 0, 1310745, 0, 0, 1310746, 0, 0, 1310747, 0, 0, 1310748, 0, 0, 1310749, 0, 0, 1310750, 0, 0, 1310751, 0, 0, 1310752, 0, 0, 1310753, 0, 0, 1310754, 0, 0, 1310755, 0, 0, 1310756, 0, 0, 1310757, 0, 0, 1310758, 0, 0, 1310759, 0, 2, 1310760, 0, 262145, 1310761, 0, 262145, 1310762, 0, 262144, 1310763, 0, 262145, 1310764, 0, 262144, 1310765, 0, 262146, 1310766, 0, 262147, 1310767, 0, 786435, 1310779, 0, 327681, 1376256, 0, 131072, 1376257, 0, 5, 1376258, 0, 5, 1376259, 0, 5, 1376260, 0, 5, 1376261, 0, 5, 1376262, 0, 5, 1376263, 0, 5, 1376264, 0, 5, 1376265, 0, 5, 1376266, 0, 5, 1376267, 0, 5, 1376268, 0, 5, 1376269, 0, 5, 1376270, 0, 5, 1376271, 0, 5, 1376272, 0, 5, 1376273, 0, 5, 1376274, 0, 5, 1376275, 0, 5, 1376276, 0, 5, 1376277, 0, 5, 1376278, 0, 5, 1376279, 0, 5, 1376280, 0, 5, 1376281, 0, 5, 1376282, 0, 5, 1376283, 0, 5, 1376284, 0, 5, 1376285, 0, 5, 1376286, 0, 5, 1376287, 0, 5, 1376288, 0, 5, 1376289, 0, 5, 1376290, 0, 5, 1376291, 0, 5, 1376292, 0, 5, 1376293, 0, 5, 1376294, 0, 5, 1376295, 0, 196608, 1376303, 0, 327681, 1376315, 0, 327681, 1441792, 0, 851968, 1441793, 0, 65536, 1441794, 0, 65536, 1441795, 0, 65536, 1441796, 0, 65536, 1441797, 0, 65536, 1441798, 0, 65536, 1441799, 0, 65536, 1441800, 0, 65536, 1441801, 0, 65536, 1441802, 0, 65536, 1441803, 0, 65536, 1441804, 0, 65536, 1441805, 0, 65536, 1441806, 0, 65536, 1441807, 0, 65536, 1441808, 0, 65536, 1441809, 0, 65536, 1441810, 0, 131076, 1441811, 0, 4, 1441812, 0, 65536, 1441813, 0, 65536, 1441814, 0, 65536, 1441815, 0, 65536, 1441816, 0, 65536, 1441817, 0, 65536, 1441818, 0, 65536, 1441819, 0, 65536, 1441820, 0, 65536, 1441821, 0, 65536, 1441822, 0, 65536, 1441823, 0, 65536, 1441824, 0, 65536, 1441825, 0, 65536, 1441826, 0, 65536, 1441827, 0, 65536, 1441828, 0, 65536, 1441829, 0, 65536, 1441830, 0, 65536, 1441831, 0, 917504, 1441839, 0, 327683, 1441851, 0, 327682, 1507346, 0, 131072, 1507347, 0, 196608, 1507375, 0, 85Line truncated tile_data = PoolIntArray( -393216, 0, 393218, -327680, 0, 327680, -327641, 0, 393216, -262144, 0, 327683, -262105, 0, 327683, -196608, 0, 327682, -196569, 0, 327681, -131072, 0, 327682, -131033, 0, 327681, -65536, 0, 327681, -65497, 0, 327682, 0, 0, 327683, 39, 0, 327680, 65536, 0, 327680, 65575, 0, 327681, 131072, 0, 327681, 131111, 0, 327682, 196608, 0, 327683, 196622, 0, 524291, 196623, 0, 262145, 196624, 0, 262145, 196625, 0, 589827, 196630, 0, 524289, 196631, 0, 262145, 196632, 0, 262145, 196633, 0, 589825, 196647, 0, 327682, 262144, 0, 131075, 262145, 0, 262145, 262146, 0, 3, 262147, 0, 262147, 262148, 0, 786434, 262152, 0, 720896, 262153, 0, 786432, 262183, 0, 327683, 327680, 0, 327681, 327682, 0, 327682, 327684, 0, 327682, 327688, 0, 131072, 327689, 0, 196608, 327708, 0, 524288, 327709, 0, 262146, 327710, 0, 262145, 327711, 0, 589825, 327719, 0, 327680, 393216, 0, 327680, 393218, 0, 327680, 393220, 0, 327683, 393224, 0, 131072, 393225, 0, 196608, 393255, 0, 327680, 458752, 0, 327682, 458754, 0, 327683, 458756, 0, 327683, 458760, 0, 131072, 458761, 0, 196608, 458791, 0, 327683, 524288, 0, 327681, 524290, 0, 851971, 524291, 0, 262144, 524292, 0, 196611, 524296, 0, 131072, 524297, 0, 196608, 524327, 0, 327682, 589824, 0, 327682, 589828, 0, 327683, 589832, 0, 131072, 589833, 0, 196608, 589857, 0, 524288, 589858, 0, 262147, 589859, 0, 589827, 589863, 0, 327683, 655360, 0, 327681, 655362, 0, 393217, 655364, 0, 327680, 655368, 0, 131072, 655369, 0, 196608, 655399, 0, 327680, 720896, 0, 327681, 720898, 0, 851970, 720899, 0, 262144, 720900, 0, 196611, 720904, 0, 131072, 720905, 0, 196608, 720935, 0, 327680, 786432, 0, 327681, 786436, 0, 327682, 786440, 0, 131072, 786441, 0, 196608, 786471, 0, 327683, 851968, 0, 327680, 851970, 0, 720898, 851971, 0, 262144, 851972, 0, 196611, 851976, 0, 131072, 851977, 0, 196608, 852001, 0, 524289, 852002, 0, 262147, 852003, 0, 262145, 852004, 0, 262146, 852005, 0, 262145, 852006, 0, 262146, 852007, 0, 196611, 917504, 0, 327681, 917506, 0, 327681, 917508, 0, 327682, 917512, 0, 131072, 917513, 0, 196608, 917543, 0, 327681, 983040, 0, 131075, 983041, 0, 262146, 983042, 0, 65539, 983043, 0, 262146, 983044, 0, 917506, 983048, 0, 851969, 983049, 0, 917504, 983079, 0, 327680, 1048576, 0, 327681, 1048602, 0, 524291, 1048603, 0, 262144, 1048604, 0, 262146, 1048605, 0, 262146, 1048606, 0, 589826, 1048615, 0, 327681, 1114112, 0, 327681, 1114151, 0, 327682, 1179648, 0, 327683, 1179687, 0, 327683, 1245184, 0, 327680, 1245223, 0, 327681, 1310720, 0, 131074, 1310721, 0, 0, 1310722, 0, 0, 1310723, 0, 0, 1310724, 0, 0, 1310725, 0, 0, 1310726, 0, 0, 1310727, 0, 0, 1310728, 0, 0, 1310729, 0, 0, 1310730, 0, 0, 1310731, 0, 0, 1310732, 0, 0, 1310733, 0, 0, 1310734, 0, 0, 1310735, 0, 0, 1310736, 0, 0, 1310737, 0, 0, 1310738, 0, 0, 1310739, 0, 0, 1310740, 0, 0, 1310741, 0, 0, 1310742, 0, 0, 1310743, 0, 0, 1310744, 0, 0, 1310745, 0, 0, 1310746, 0, 0, 1310747, 0, 0, 1310748, 0, 0, 1310749, 0, 0, 1310750, 0, 0, 1310751, 0, 0, 1310752, 0, 0, 1310753, 0, 0, 1310754, 0, 0, 1310755, 0, 0, 1310756, 0, 0, 1310757, 0, 0, 1310758, 0, 0, 1310759, 0, 196609, 1376256, 0, 131072, 1376257, 0, 5, 1376258, 0, 5, 1376259, 0, 5, 1376260, 0, 5, 1376261, 0, 5, 1376262, 0, 5, 1376263, 0, 5, 1376264, 0, 5, 1376265, 0, 5, 1376266, 0, 5, 1376267, 0, 5, 1376268, 0, 5, 1376269, 0, 5, 1376270, 0, 5, 1376271, 0, 5, 1376272, 0, 5, 1376273, 0, 5, 1376274, 0, 5, 1376275, 0, 5, 1376276, 0, 5, 1376277, 0, 5, 1376278, 0, 5, 1376279, 0, 5, 1376280, 0, 5, 1376281, 0, 5, 1376282, 0, 5, 1376283, 0, 5, 1376284, 0, 5, 1376285, 0, 5, 1376286, 0, 5, 1376287, 0, 5, 1376288, 0, 5, 1376289, 0, 5, 1376290, 0, 5, 1376291, 0, 5, 1376292, 0, 5, 1376293, 0, 5, 1376294, 0, 5, 1376295, 0, 196608, 1441792, 0, 851968, 1441793, 0, 65536, 1441794, 0, 65536, 1441795, 0, 65536, 1441796, 0, 65536, 1441797, 0, 65536, 1441798, 0, 65536, 1441799, 0, 65536, 1441800, 0, 65536, 1441801, 0, 65536, 1441802, 0, 65536, 1441803, 0, 65536, 1441804, 0, 65536, 1441805, 0, 65536, 1441806, 0, 65536, 1441807, 0, 65536, 1441808, 0, 65536, 1441809, 0, 65536, 1441810, 0, 65536, 1441811, 0, 65536, 1441812, 0, 65536, 1441813, 0, 65536, 1441814, 0, 65536, 1441815, 0, 65536, 1441816, 0, 65536, 1441817, 0, 65536, 1441818, 0, 65536, 1441819, 0, 65536, 1441820, 0, 65536, 1441821, 0, 65536, 1441822, 0, 65536, 1441823, 0, 65536, 1441824, 0, 65536, 1441825, 0, 65536, 1441826, 0, 65536, 1441827, 0, 65536, 1441828, 0, 65536, 1441829, 0, 65536, 1441830, 0, 65536, 1441831, 0, 917504 )
[node name="CameraLimitArea" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="CameraLimitArea"]
position = Vector2( 160, 88 )
shape = SubResource( 63 )
[connection signal="body_shape_entered" from="CameraLimitArea" to="Player" method="_on_CameraLimitArea_body_shape_entered"]
[connection signal="body_shape_exited" from="CameraLimitArea" to="Player" method="_on_CameraLimitArea_body_shape_exited"]