mirror of
https://forge.univ-lyon1.fr/tplifap4/dungeonanddeamon.git
synced 2024-02-27 13:31:50 +01:00
ajustement godot
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,8 +0,0 @@
|
|||||||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
|
||||||
|
|
||||||
[ext_resource path="res://script/TestJeuxGDN.gdnlib" type="GDNativeLibrary" id=1]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
resource_name = "Player"
|
|
||||||
class_name = "Player"
|
|
||||||
library = ExtResource( 1 )
|
|
@ -91,14 +91,9 @@ animations = [ {
|
|||||||
"name": "idle",
|
"name": "idle",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 13 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 14 ), ExtResource( 12 ), ExtResource( 15 ), ExtResource( 21 ), ExtResource( 18 ), ExtResource( 20 ), ExtResource( 19 ) ],
|
"frames": [ ExtResource( 53 ), ExtResource( 62 ), ExtResource( 43 ), ExtResource( 51 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "run",
|
"name": "degat",
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ ExtResource( 56 ), ExtResource( 48 ), ExtResource( 44 ), ExtResource( 34 ), ExtResource( 54 ), ExtResource( 35 ), ExtResource( 49 ), ExtResource( 46 ), ExtResource( 47 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "mort",
|
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 45 ), ExtResource( 41 ), ExtResource( 42 ), ExtResource( 63 ), ExtResource( 58 ), ExtResource( 59 ), ExtResource( 40 ), ExtResource( 55 ), ExtResource( 36 ) ],
|
"frames": [ ExtResource( 45 ), ExtResource( 41 ), ExtResource( 42 ), ExtResource( 63 ), ExtResource( 58 ), ExtResource( 59 ), ExtResource( 40 ), ExtResource( 55 ), ExtResource( 36 ) ],
|
||||||
@ -106,21 +101,16 @@ animations = [ {
|
|||||||
"name": "attack02",
|
"name": "attack02",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
|
"frames": [ ExtResource( 13 ), ExtResource( 16 ), ExtResource( 17 ), ExtResource( 14 ), ExtResource( 12 ), ExtResource( 15 ), ExtResource( 21 ), ExtResource( 18 ), ExtResource( 20 ), ExtResource( 19 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "run",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
"frames": [ ExtResource( 71 ), ExtResource( 66 ), ExtResource( 67 ), ExtResource( 72 ), ExtResource( 74 ), ExtResource( 77 ), ExtResource( 80 ), ExtResource( 79 ), ExtResource( 75 ) ],
|
"frames": [ ExtResource( 71 ), ExtResource( 66 ), ExtResource( 67 ), ExtResource( 72 ), ExtResource( 74 ), ExtResource( 77 ), ExtResource( 80 ), ExtResource( 79 ), ExtResource( 75 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "roulade",
|
"name": "roulade",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 53 ), ExtResource( 62 ), ExtResource( 43 ), ExtResource( 51 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "degat",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ ExtResource( 33 ), ExtResource( 38 ), ExtResource( 33 ), ExtResource( 39 ), ExtResource( 38 ), ExtResource( 50 ) ],
|
|
||||||
"loop": true,
|
|
||||||
"name": "fall",
|
|
||||||
"speed": 5.0
|
|
||||||
}, {
|
|
||||||
"frames": [ ExtResource( 65 ), ExtResource( 81 ), ExtResource( 76 ), ExtResource( 70 ), ExtResource( 68 ) ],
|
"frames": [ ExtResource( 65 ), ExtResource( 81 ), ExtResource( 76 ), ExtResource( 70 ), ExtResource( 68 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "degat shield",
|
"name": "degat shield",
|
||||||
@ -131,15 +121,25 @@ animations = [ {
|
|||||||
"name": "attack01",
|
"name": "attack01",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 57 ), ExtResource( 52 ), ExtResource( 69 ), ExtResource( 64 ), ExtResource( 78 ), ExtResource( 73 ), ExtResource( 65 ) ],
|
"frames": [ ExtResource( 33 ), ExtResource( 38 ), ExtResource( 33 ), ExtResource( 39 ), ExtResource( 38 ), ExtResource( 50 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "shield",
|
"name": "fall",
|
||||||
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 56 ), ExtResource( 48 ), ExtResource( 44 ), ExtResource( 34 ), ExtResource( 54 ), ExtResource( 35 ), ExtResource( 49 ), ExtResource( 46 ), ExtResource( 47 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "mort",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
"frames": [ ExtResource( 37 ), ExtResource( 60 ), ExtResource( 61 ), ExtResource( 50 ), ExtResource( 38 ), ExtResource( 33 ), ExtResource( 39 ) ],
|
"frames": [ ExtResource( 37 ), ExtResource( 60 ), ExtResource( 61 ), ExtResource( 50 ), ExtResource( 38 ), ExtResource( 33 ), ExtResource( 39 ) ],
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"name": "jump",
|
"name": "jump",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
|
}, {
|
||||||
|
"frames": [ ExtResource( 57 ), ExtResource( 52 ), ExtResource( 69 ), ExtResource( 64 ), ExtResource( 78 ), ExtResource( 73 ), ExtResource( 65 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "shield",
|
||||||
|
"speed": 5.0
|
||||||
} ]
|
} ]
|
||||||
|
|
||||||
[node name="Stageone" type="Node2D"]
|
[node name="Stageone" type="Node2D"]
|
||||||
@ -173,6 +173,7 @@ shape = SubResource( 1 )
|
|||||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="Player"]
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="Player"]
|
||||||
frames = SubResource( 2 )
|
frames = SubResource( 2 )
|
||||||
animation = "fall"
|
animation = "fall"
|
||||||
|
frame = 5
|
||||||
playing = true
|
playing = true
|
||||||
|
|
||||||
[node name="TileMap" type="TileMap" parent="."]
|
[node name="TileMap" type="TileMap" parent="."]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[gd_resource type="NativeScript" load_steps=2 format=2]
|
[gd_resource type="NativeScript" load_steps=2 format=2]
|
||||||
|
|
||||||
[sub_resource type="GDNativeLibrary" id=1]
|
[sub_resource type="GDNativeLibrary" id=1]
|
||||||
entry/Windows.64 = "res://.script/JeuxLIFAP5.dll"
|
entry/Windows.64 = "res://Dungeonanddemon.dll"
|
||||||
dependency/Windows.64 = [ ]
|
dependency/Windows.64 = [ ]
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
[entry]
|
|
||||||
|
|
||||||
Windows.64="res://JeuxLIFAP5.dll"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
|
|
||||||
Windows.64=[ ]
|
|
||||||
|
|
||||||
[general]
|
|
||||||
|
|
||||||
singleton=false
|
|
||||||
load_once=true
|
|
||||||
symbol_prefix="godot_"
|
|
||||||
reloadable=true
|
|
@ -1,25 +1,71 @@
|
|||||||
#include "GestionPlayer.h"
|
#include "GestionPlayer.h"
|
||||||
|
|
||||||
void GestionPlayer::droit()
|
#include "GestionPlayer.h"
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
void Player::_register_methods() {
|
||||||
|
register_method((char*)"_process", &Player::_process);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GestionPlayer::gauche()
|
void Player::_init() {}
|
||||||
{
|
|
||||||
|
Player::Player() {
|
||||||
|
velocity = Vector2(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GestionPlayer::bas()
|
Player::~Player() {}
|
||||||
|
|
||||||
|
void Player::_process(float delta)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
UpdateMotionFromInput();
|
||||||
|
|
||||||
|
velocity = move_and_slide(velocity, FLOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GestionPlayer::saut()
|
void Player::UpdateMotionFromInput()
|
||||||
{
|
{
|
||||||
|
velocity = Vector2(0, 0);
|
||||||
|
FLOOR = Vector2(0, -1);
|
||||||
|
|
||||||
|
|
||||||
|
Input* i = Input::get_singleton();
|
||||||
|
|
||||||
|
if (i->is_action_pressed("ui_left"))
|
||||||
|
{
|
||||||
|
|
||||||
|
velocity.x -= speed;
|
||||||
|
void play(String anim = "run", bool backwards = false);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GestionPlayer::idle()
|
|
||||||
{
|
|
||||||
|
else if (i->is_action_pressed("ui_right"))
|
||||||
|
velocity.x += speed;
|
||||||
|
else
|
||||||
|
velocity.x = 0.0;
|
||||||
|
|
||||||
|
if (i->is_action_pressed("ui_select")) {
|
||||||
|
if (on_ground == true) {
|
||||||
|
velocity.y = power_jump;
|
||||||
|
on_ground = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GestionPlayer::attack()
|
|
||||||
{
|
|
||||||
|
if (is_on_floor()) {
|
||||||
|
on_ground = true;
|
||||||
|
velocity.y += 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
on_ground = false;
|
||||||
|
velocity.y += gravity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,59 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
|
||||||
class GestionPlayer
|
#pragma once
|
||||||
{
|
|
||||||
public:
|
|
||||||
Player p;
|
|
||||||
|
|
||||||
|
#include <Godot.hpp>
|
||||||
|
#include <KinematicBody2D.hpp>
|
||||||
|
#include <Input.hpp>
|
||||||
|
|
||||||
|
namespace godot {
|
||||||
|
class Player : public KinematicBody2D
|
||||||
|
{
|
||||||
|
|
||||||
|
// Godot structure
|
||||||
|
private:
|
||||||
|
GODOT_CLASS(Player, KinematicBody2D)
|
||||||
public:
|
public:
|
||||||
void droit();
|
static void _register_methods();
|
||||||
void gauche();
|
void _init();
|
||||||
void bas();
|
void _process(float delta);
|
||||||
void saut();
|
|
||||||
void idle();
|
Player();
|
||||||
void attack();
|
~Player();
|
||||||
|
|
||||||
|
|
||||||
|
// Gameplay variables
|
||||||
|
public:
|
||||||
|
|
||||||
|
const int speed = 100;
|
||||||
|
const int gravity = 90;
|
||||||
|
const int power_jump = -2500;
|
||||||
|
bool on_ground = false;
|
||||||
|
bool right;
|
||||||
|
bool left;
|
||||||
|
bool jump;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
Vector2 velocity;
|
||||||
|
Vector2 FLOOR;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Gameplay methods
|
||||||
|
public:
|
||||||
|
void UpdateMotionFromInput();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
attack();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
GodoBinding/include/gen/.gitignore
vendored
2
GodoBinding/include/gen/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
Reference in New Issue
Block a user