ajout accéleration
This commit is contained in:
parent
39e34e9be1
commit
048bb09ab7
4 changed files with 126 additions and 2 deletions
37
ressources/images/cgj_default_tile.svg.import
Normal file
37
ressources/images/cgj_default_tile.svg.import
Normal file
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://iwrdb61rkpsx"
|
||||
path="res://.godot/imported/cgj_default_tile.svg-6f24db072965547b576ce8b63fbe7ec8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ressources/images/cgj_default_tile.svg"
|
||||
dest_files=["res://.godot/imported/cgj_default_tile.svg-6f24db072965547b576ce8b63fbe7ec8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
37
ressources/images/cgj_tile_1.svg.import
Normal file
37
ressources/images/cgj_tile_1.svg.import
Normal file
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d1d462gptgad8"
|
||||
path="res://.godot/imported/cgj_tile_1.svg-6f1497fb2775a0586cdf5be113ac6ba6.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ressources/images/cgj_tile_1.svg"
|
||||
dest_files=["res://.godot/imported/cgj_tile_1.svg-6f1497fb2775a0586cdf5be113ac6ba6.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
37
ressources/images/cgj_tile_2.svg.import
Normal file
37
ressources/images/cgj_tile_2.svg.import
Normal file
|
@ -0,0 +1,37 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://rey6oul5tla0"
|
||||
path="res://.godot/imported/cgj_tile_2.svg-1008c878b662a507cf2fef633a6dc4aa.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://ressources/images/cgj_tile_2.svg"
|
||||
dest_files=["res://.godot/imported/cgj_tile_2.svg-1008c878b662a507cf2fef633a6dc4aa.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
|
@ -1,6 +1,12 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
const move_speed = 400
|
||||
const acceleration = 0.25
|
||||
const max_boost_speed = 800
|
||||
|
||||
var previous_direction = Vector2.ZERO
|
||||
var boost_speed = 0
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
move_and_slide()
|
||||
|
@ -10,6 +16,13 @@ func _process(delta: float) -> void:
|
|||
direction.x = Input.get_action_raw_strength("BOUGER_DROITE") - Input.get_action_raw_strength("BOUGER_GAUCHE")
|
||||
direction.y = Input.get_action_raw_strength("BOUGER_BAS") - Input.get_action_raw_strength("BOUGER_HAUT")
|
||||
|
||||
velocity = direction * move_speed
|
||||
|
||||
|
||||
if direction != Vector2.ZERO:
|
||||
if direction == previous_direction:
|
||||
boost_speed = min(boost_speed + acceleration, max_boost_speed - move_speed)
|
||||
else:
|
||||
boost_speed = 0
|
||||
previous_direction = direction
|
||||
velocity = direction * (move_speed + boost_speed)
|
||||
print(velocity)
|
||||
pass
|
||||
|
|
Loading…
Add table
Reference in a new issue