Initial commit

This commit is contained in:
Oleksiy
2021-07-27 22:23:57 +03:00
commit 6cf84a1951
208 changed files with 4053 additions and 0 deletions

27
Actors/Dust.tscn Normal file
View File

@ -0,0 +1,27 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Assets/dirt.png" type="Texture" id=1]
[ext_resource path="res://Dust.gd" type="Script" id=2]
[ext_resource path="res://dirt.gd" type="Script" id=3]
[sub_resource type="CapsuleShape2D" id=1]
radius = 2.12476
height = 0.0
[node name="Dust" type="Area2D"]
modulate = Color( 0.654902, 0.560784, 0.235294, 1 )
z_index = -1
collision_layer = 4
collision_mask = 2
script = ExtResource( 2 )
[node name="dirt" type="Sprite" parent="."]
position = Vector2( 0.0312853, -0.0104284 )
texture = ExtResource( 1 )
vframes = 8
script = ExtResource( 3 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[connection signal="body_entered" from="." to="." method="_on_Dust_body_entered"]

41
Actors/Player.gd Normal file
View File

@ -0,0 +1,41 @@
extends KinematicBody2D
export var MAX_SPEED = 300
var movement = Vector2.ZERO
#var pushing = 0
onready var animationPlayer = $AnimationPlayer
func _physics_process(_delta):
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength("Right") - Input.get_action_strength("Left")
input_vector.y = Input.get_action_strength("Down") - Input.get_action_strength("Up")
if (input_vector.x == 1 and input_vector.y == 0):
rotation_degrees = 0
animationPlayer.play("straight")
elif(input_vector.x == -1 and input_vector.y == 0):
rotation_degrees = 180
animationPlayer.play("straight")
elif (input_vector.x == 0 and input_vector.y == 1):
rotation_degrees = 90
animationPlayer.play("straight")
elif(input_vector.x == 0 and input_vector.y == -1):
rotation_degrees = 270
animationPlayer.play("straight")
elif(input_vector.x == 1 and input_vector.y == 1):
rotation_degrees = 90
animationPlayer.play("diagonal")
elif (input_vector.x == 1 and input_vector.y == -1):
rotation_degrees = 0
animationPlayer.play("diagonal")
elif(input_vector.x == -1 and input_vector.y == 1):
rotation_degrees = 180
animationPlayer.play("diagonal")
elif(input_vector.x == -1 and input_vector.y == -1):
rotation_degrees = 270
animationPlayer.play("diagonal")
else:
animationPlayer.play("stop")
input_vector = input_vector.normalized()
movement.x = input_vector.x * MAX_SPEED #* delta
movement.y = input_vector.y * MAX_SPEED #* delta
movement = move_and_slide(movement)

73
Actors/Player.tscn Normal file
View File

@ -0,0 +1,73 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://Assets/player-sprite.png" type="Texture" id=1]
[ext_resource path="res://Actors/Player.gd" type="Script" id=2]
[sub_resource type="CapsuleShape2D" id=1]
radius = 6.05681
height = 8.53165
[sub_resource type="Animation" id=2]
resource_name = "diagonal"
length = 0.4
tracks/0/type = "value"
tracks/0/path = NodePath("player-sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 4, 5 ]
}
[sub_resource type="Animation" id=3]
resource_name = "stop"
tracks/0/type = "value"
tracks/0/path = NodePath("player-sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0 ),
"transitions": PoolRealArray( 1 ),
"update": 1,
"values": [ 0 ]
}
[sub_resource type="Animation" id=4]
length = 0.4
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath("player-sprite:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.2 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 1,
"values": [ 1, 2 ]
}
[node name="Player" type="KinematicBody2D"]
visible = false
script = ExtResource( 2 )
[node name="player-sprite" type="Sprite" parent="."]
rotation = -1.5708
texture = ExtResource( 1 )
vframes = 6
frame = 1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
anims/diagonal = SubResource( 2 )
anims/stop = SubResource( 3 )
anims/straight = SubResource( 4 )

28
Actors/Robot.gd Normal file
View File

@ -0,0 +1,28 @@
extends KinematicBody2D
onready var bump = $Bump
export var MAX_SPEED = 300
var movement = Vector2.ZERO
var direction = Vector2.ZERO
func _ready():
change_direction()
func _physics_process(delta):
movement.x = direction.x * MAX_SPEED * delta
movement.y = direction.y * MAX_SPEED * delta
if(move_and_collide(movement)):
change_direction()
#print(get_slide_collision(movement))
func change_direction():
var rng = RandomNumberGenerator.new()
rng.randomize()
direction.x = rng.randf_range(-1.0, 1.0)
rng.randomize()
direction.y = rng.randf_range(-1.0, 1.0)
direction = direction.normalized()
rotation_degrees = rad2deg(direction.angle())
if (!bump.playing):
bump.play()

22
Actors/Robot.tscn Normal file
View File

@ -0,0 +1,22 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://Assets/robot.png" type="Texture" id=1]
[ext_resource path="res://Actors/Robot.gd" type="Script" id=2]
[ext_resource path="res://sounds/bump.mp3" type="AudioStream" id=3]
[sub_resource type="CircleShape2D" id=1]
radius = 9.39408
[node name="Robot" type="KinematicBody2D"]
script = ExtResource( 2 )
[node name="robot" type="Sprite" parent="."]
rotation = 1.5708
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource( 1 )
[node name="Bump" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 3 )
volume_db = -6.0

16
Actors/Table.tscn Normal file
View File

@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://icon.png" type="Texture" id=1]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 102.658, 48.6519 )
[node name="StaticBody2D" type="RigidBody2D"]
[node name="icon" type="Sprite" parent="."]
scale = Vector2( 3.1926, 1.53886 )
texture = ExtResource( 1 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0, -1 )
shape = SubResource( 1 )