as4s4hetic
3 years ago
8 changed files with 132 additions and 3 deletions
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
extends KinematicBody2D |
||||
|
||||
|
||||
# Declare member variables here. Examples: |
||||
# var a = 2 |
||||
# var b = "text" |
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time. |
||||
var moveSpeed : int = 280 |
||||
var vel = Vector2() |
||||
var facingDir = Vector2() |
||||
onready var rayCast = $RayCast2D |
||||
onready var anim = $AnimatedSprite |
||||
|
||||
func _ready(): |
||||
pass |
||||
|
||||
func _physics_process(delta): |
||||
handle_movements() |
||||
manage_animations() |
||||
|
||||
func handle_movements(): |
||||
vel = Vector2(-1, 0) |
||||
|
||||
# inputs |
||||
if Input.is_action_pressed("move_up"): |
||||
vel.y = -1 |
||||
if Input.is_action_pressed("move_down"): |
||||
vel.y = 1 |
||||
if Input.is_action_pressed("move_left"): |
||||
moveSpeed += 5 |
||||
else: |
||||
moveSpeed -= 1 |
||||
if Input.is_action_pressed("move_right"): |
||||
moveSpeed -= 5 |
||||
moveSpeed = clamp(moveSpeed, 280, 500) |
||||
|
||||
# move the player |
||||
move_and_slide(vel * moveSpeed, Vector2.ZERO) |
||||
|
||||
func play_animation (anim_name): |
||||
if anim.animation != anim_name: |
||||
anim.play(anim_name) |
||||
|
||||
func manage_animations (): |
||||
if Input.is_action_pressed("move_left"): |
||||
play_animation("Accelerate") |
||||
else: |
||||
play_animation("default") |
After Width: | Height: | Size: 3.9 KiB |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="StreamTexture" |
||||
path="res://.import/car-full-2a.png-0f64cdfb4ad576205590422cb4a652b5.stex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Sprites/alistair/car-full-2a.png" |
||||
dest_files=[ "res://.import/car-full-2a.png-0f64cdfb4ad576205590422cb4a652b5.stex" ] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_mode=0 |
||||
compress/bptc_ldr=0 |
||||
compress/normal_map=0 |
||||
flags/repeat=0 |
||||
flags/filter=true |
||||
flags/mipmaps=false |
||||
flags/anisotropic=false |
||||
flags/srgb=2 |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/HDR_as_SRGB=false |
||||
process/invert_color=false |
||||
process/normal_map_invert_y=false |
||||
stream=false |
||||
size_limit=0 |
||||
detect_3d=true |
||||
svg/scale=1.0 |
After Width: | Height: | Size: 3.9 KiB |
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="StreamTexture" |
||||
path="res://.import/car-full-3a.png-376bde5618312891a4e2f322b963c7d6.stex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://Sprites/alistair/car-full-3a.png" |
||||
dest_files=[ "res://.import/car-full-3a.png-376bde5618312891a4e2f322b963c7d6.stex" ] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_mode=0 |
||||
compress/bptc_ldr=0 |
||||
compress/normal_map=0 |
||||
flags/repeat=0 |
||||
flags/filter=true |
||||
flags/mipmaps=false |
||||
flags/anisotropic=false |
||||
flags/srgb=2 |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/HDR_as_SRGB=false |
||||
process/invert_color=false |
||||
process/normal_map_invert_y=false |
||||
stream=false |
||||
size_limit=0 |
||||
detect_3d=true |
||||
svg/scale=1.0 |
Loading…
Reference in new issue