~sjm/well-kard

253ace0a6e5f2763dfcc1c533e7f3de28dfddf4d — Sam Marshall 3 years ago
initial commit
A  => .import/icon.png-487276ed1e3a0c39cad0279d744ee560.md5 +3 -0
@@ 1,3 @@
source_md5="47313fa4c47a9963fddd764e1ec6e4a8"
dest_md5="2ded9e7f9060e2b530aab678b135fc5b"


A  => .import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex +0 -0
A  => .import/player.png-be2216fcaabb5c62aa2466cd9a5726a8.md5 +3 -0
@@ 1,3 @@
source_md5="1e98a3eabfc0c033f9c10028e10ead11"
dest_md5="3a33a89774c5b09c48980c83ca5eca5d"


A  => .import/player.png-be2216fcaabb5c62aa2466cd9a5726a8.stex +0 -0
A  => Player.gd +34 -0
@@ 1,34 @@
extends RigidBody2D

var target = Vector2()
export var speed = 400
# Declare member variables here. Examples:
# var a = 2
# var b = "text"

func start(pos):
	position = pos
	target = pos
	
func _input(event):
	if event is InputEventMouseButton and event.pressed:
		target = event.position
		print_debug()

# Called when the node enters the scene tree for the first time.
func _ready():
	target = position

func _process(delta):
	var velocity = Vector2()
	var direction = Vector2()
	
	if position.distance_to(target) > 10:
		direction = target - position
	
	if direction.length() > 0:
		velocity = direction.normalized() * speed 
		$Sprite.rotation = Vector2.UP.angle_to(direction)
		
	position += velocity * delta


A  => Player.tscn +20 -0
@@ 1,20 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://assets/player.png" type="Texture" id=1]
[ext_resource path="res://Player.gd" type="Script" id=2]

[sub_resource type="CapsuleShape2D" id=1]
radius = 117.346
height = 251.497

[node name="Player" type="RigidBody2D"]
gravity_scale = 0.0
script = ExtResource( 2 )
speed = 800

[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5708
shape = SubResource( 1 )

A  => assets/player.png +0 -0
A  => assets/player.png.import +34 -0
@@ 1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/player.png-be2216fcaabb5c62aa2466cd9a5726a8.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/player.png"
dest_files=[ "res://.import/player.png-be2216fcaabb5c62aa2466cd9a5726a8.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

A  => default_env.tres +7 -0
@@ 1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]

[sub_resource type="ProceduralSky" id=1]

[resource]
background_mode = 2
background_sky = SubResource( 1 )

A  => icon.png +0 -0
A  => icon.png.import +34 -0
@@ 1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

A  => project.godot +22 -0
@@ 1,22 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
;   [section] ; section goes between []
;   param=value ; assign values to parameters

config_version=4

[application]

config/name="well-kard"
config/icon="res://icon.png"

[physics]

common/enable_pause_aware_picking=true

[rendering]

environment/default_environment="res://default_env.tres"