feature/state_machine #5

Merged
cromer merged 8 commits from feature/state_machine into develop 2022-04-13 09:39:42 -04:00
3 changed files with 32 additions and 4 deletions
Showing only changes of commit ac86f148ba - Show all commits

View File

@ -7,3 +7,9 @@
script = ExtResource( 1 )
[node name="Level1" parent="." instance=ExtResource( 2 )]
[node name="StateMachine" type="Node" parent="."]
[node name="Walk" type="Node" parent="StateMachine"]
[node name="Run" type="Node" parent="StateMachine"]

View File

@ -1,13 +1,14 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=5 format=2]
[ext_resource path="res://characters/player/sprites/green.tres" type="SpriteFrames" id=1]
[ext_resource path="res://characters/player/Player.gdns" type="Script" id=2]
[ext_resource path="res://characters/player/states/Idle.gdns" type="Script" id=2]
[ext_resource path="res://characters/player/Player.gdns" type="Script" id=3]
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 7, 11.5 )
[node name="Player" type="KinematicBody2D"]
script = ExtResource( 2 )
script = ExtResource( 3 )
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
frames = ExtResource( 1 )
@ -18,4 +19,15 @@ centered = false
position = Vector2( 12, 12.5 )
shape = SubResource( 1 )
[connection signal="player_moved" from="." to="." method="_on_Player_player_moved"]
[node name="StateMachine" type="Node" parent="."]
[node name="Idle" type="Node" parent="StateMachine"]
script = ExtResource( 2 )
[node name="Move" type="Node" parent="StateMachine"]
[node name="Jump" type="Node" parent="StateMachine"]
[node name="DoubleJump" type="Node" parent="StateMachine"]
[node name="Fall" type="Node" parent="StateMachine"]

View File

@ -1,7 +1,12 @@
#include <Godot.hpp>
#include "StateMachine.h"
#include "State.h"
#include "Walk.h"
#include "Run.h"
#include "Main.h"
#include "Player.h"
#include "PlayerIdle.h"
using namespace godot;
@ -21,6 +26,11 @@ extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_opt
extern "C" void GDN_EXPORT godot_nativescript_init(void *handle)
{
Godot::nativescript_init(handle);
register_class<StateMachine>();
register_class<State>();
register_class<Walk>();
register_class<Run>();
register_class<Main>();
register_class<Player>();
register_class<PlayerIdle>();
}