generated from 201flaviosilva-labs/Godot-Repository-Template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6e83cf
commit ec2e06a
Showing
22 changed files
with
136 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
extends Area2D | ||
|
||
export (float, 0.1, 1) var normal_speed: float = 0.25 | ||
|
||
const GRID_SIZE = 64 | ||
var direction: Vector2 = Vector2.RIGHT | ||
var speed: float = normal_speed | ||
|
||
func _ready() -> void: | ||
_set_speed(normal_speed) | ||
|
||
func _process(delta: float) -> void: | ||
if Input.is_action_just_pressed("up"): direction = Vector2.UP | ||
if Input.is_action_just_pressed("down"): direction = Vector2.DOWN | ||
if Input.is_action_just_pressed("left"): direction = Vector2.LEFT | ||
if Input.is_action_just_pressed("right"): direction = Vector2.RIGHT | ||
|
||
if Input.is_action_just_pressed("run"): _set_speed(normal_speed / 2) | ||
elif Input.is_action_just_released("run"): _set_speed(normal_speed) | ||
|
||
func _on_Move_timeout() -> void: | ||
global_position += direction * GRID_SIZE | ||
|
||
func _set_speed(value: float) -> void: | ||
var move_timer = $Move | ||
speed = value | ||
move_timer.wait_time = speed | ||
move_timer.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://icon.png" type="Texture" id=1] | ||
[ext_resource path="res://Player/Player.gd" type="Script" id=2] | ||
|
||
[sub_resource type="RectangleShape2D" id=1] | ||
extents = Vector2( 29, 29 ) | ||
|
||
[node name="Player" type="Area2D"] | ||
script = ExtResource( 2 ) | ||
|
||
[node name="Sprite" type="Sprite" parent="."] | ||
rotation = 1.5708 | ||
texture = ExtResource( 1 ) | ||
|
||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] | ||
shape = SubResource( 1 ) | ||
|
||
[node name="Move" type="Timer" parent="."] | ||
wait_time = 0.25 | ||
autostart = true | ||
|
||
[connection signal="timeout" from="Move" to="." method="_on_Move_timeout"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[gd_scene load_steps=2 format=2] | ||
|
||
[ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] | ||
|
||
[node name="Game2D" type="Node2D"] | ||
|
||
[node name="Background" type="ColorRect" parent="."] | ||
margin_right = 1280.0 | ||
margin_bottom = 720.0 | ||
color = Color( 0, 0.741176, 0.239216, 1 ) | ||
|
||
[node name="Player" parent="." instance=ExtResource( 1 )] | ||
position = Vector2( 672, 384 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Oops, something went wrong.