Skip to content

Commit

Permalink
added state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
ProfAndreaPollini committed Jul 18, 2022
1 parent 6a0a2ae commit f60bfdc
Show file tree
Hide file tree
Showing 683 changed files with 189 additions and 10,007 deletions.
21 changes: 21 additions & 0 deletions Idle.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
extends State

onready var king = get_tree().get_current_scene().get_node("King")






func _physics_process(delta):
#print("_pp: Idle")
pass

func _input(event):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print("Left button was clicked at ", event.position)
switch_to("running")
if event.button_index == BUTTON_WHEEL_UP and event.pressed:
print("Wheel up")

52 changes: 13 additions & 39 deletions MainScreen.tscn
Original file line number Diff line number Diff line change
@@ -1,46 +1,20 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=5 format=2]

[ext_resource path="res://assets/Enchanted Forest Characters with animations.png" type="Texture" id=1]
[ext_resource path="res://assets/Characters.png" type="Texture" id=2]
[ext_resource path="res://assets/Fantasy RPG NPCs - Individuel Frames/Alchemist/Alchemist_Idle_1.png" type="Texture" id=3]
[ext_resource path="res://assets/dungeontiles-extended v1.1/dungeontileset-extended-palette.png" type="Texture" id=4]
[ext_resource path="res://assets/dungeontiles-extended v1.1/dungeontileset-extended.png" type="Texture" id=5]
[ext_resource path="res://assets/0x72_DungeonTilesetII_v1.4/0x72_DungeonTilesetII_v1.4/0x72_DungeonTilesetII_v1.4.png" type="Texture" id=6]
[ext_resource path="res://assets/Enchanted Forest - Individual Frames/Ranger/Ranger_Idle_1.png" type="Texture" id=7]
[ext_resource path="res://Idle.gd" type="Script" id=1]
[ext_resource path="res://Running.gd" type="Script" id=2]
[ext_resource path="res://entites/King.tscn" type="PackedScene" id=3]
[ext_resource path="res://lib/StateManager.gd" type="Script" id=8]

[node name="MainScreen" type="Node2D"]

[node name="Dungeontileset-extended" type="Sprite" parent="."]
visible = false
position = Vector2( 398, 578 )
texture = ExtResource( 5 )
[node name="King" parent="." instance=ExtResource( 3 )]
position = Vector2( 194, 147 )

[node name="Characters" type="Sprite" parent="Dungeontileset-extended"]
visible = false
position = Vector2( 140, -156 )
texture = ExtResource( 2 )
[node name="StateManager" type="Node" parent="."]
script = ExtResource( 8 )

[node name="EnchantedForestCharactersWithAnimations" type="Sprite" parent="Dungeontileset-extended"]
visible = false
position = Vector2( -198, -216 )
texture = ExtResource( 1 )
[node name="Idle" type="Node" parent="StateManager"]
script = ExtResource( 1 )

[node name="0X72DungeonTilesetIiV14" type="Sprite" parent="."]
visible = false
position = Vector2( 353, 312 )
texture = ExtResource( 6 )

[node name="RangerIdle1" type="Sprite" parent="0X72DungeonTilesetIiV14"]
visible = false
position = Vector2( -269, 124 )
texture = ExtResource( 7 )

[node name="AlchemistIdle1" type="Sprite" parent="0X72DungeonTilesetIiV14"]
visible = false
position = Vector2( -277, 155 )
texture = ExtResource( 3 )

[node name="Dungeontileset-extended-palette" type="Sprite" parent="0X72DungeonTilesetIiV14"]
visible = false
position = Vector2( -161, 168 )
texture = ExtResource( 4 )
[node name="Running" type="Node" parent="StateManager"]
script = ExtResource( 2 )
10 changes: 10 additions & 0 deletions Running.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends State


func _input(event):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and event.pressed:
print("Left button was clicked at ", event.position)
switch_to("idle")
if event.button_index == BUTTON_WHEEL_UP and event.pressed:
print("Wheel up")
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Loading

0 comments on commit f60bfdc

Please sign in to comment.