From be3f291382e88660db4393ac5f81c4a8788d8bc3 Mon Sep 17 00:00:00 2001 From: Estrela Allan p1923381 Date: Tue, 31 Mar 2020 09:26:51 +0200 Subject: [PATCH] deplacment basique joueur --- DungeonAndDeamon/.export/dugeonanddemon.pck | Bin 1434832 -> 1434832 bytes DungeonAndDeamon/icon.png | Bin 3446 -> 0 bytes DungeonAndDeamon/icon.png.import | 34 ----------- DungeonAndDeamon/script/Node2D.tscn | 53 +++++++++--------- .../DungeonAndDemaonScript/GestionPlayer.cpp | 24 ++++++-- .../DungeonAndDemaonScript/GestionPlayer.h | 13 +++++ 6 files changed, 60 insertions(+), 64 deletions(-) delete mode 100644 DungeonAndDeamon/icon.png delete mode 100644 DungeonAndDeamon/icon.png.import diff --git a/DungeonAndDeamon/.export/dugeonanddemon.pck b/DungeonAndDeamon/.export/dugeonanddemon.pck index a9a86a4071f1e786ee703f4013172ac7600699aa..9b4507838a9ace4130a4c79b2f9f74e58c26c073 100644 GIT binary patch delta 203 zcmca`GW^2H@C_Q#5@H4nV4&BYt2KS$JRi%W*$0lZD;769M7KLcGXgOa5HkZY3lOsc zF&hxG12G2>a{@6J5OV`D4-oSLF&_}~1F--Q3j(na5DNpb$aaTl(PL!n~cm TUbK>l3*uZ5xxJxLG$0uOi(f>= delta 212 zcmca`GW^2H@C_Q#5()+kVDReFxo5whFZOG{y7F50Gn<{w4$_E%`#GF9P1;pGy%mc){K+Ffk{6H)K#DYL91jNEXEVA7pT6CJkbmL0V!_(K5 ziN2ivu}ZXKx?ZuU?DmdQQFX@YM@mGGOn0vkeLH<$xv22;hDuS*=~v1{i>F^J28w;F j6uq~-vRbr-nKP{@F*jAgR>5%lpE}VhrtJ-lq5;VO!7fqF diff --git a/DungeonAndDeamon/icon.png b/DungeonAndDeamon/icon.png deleted file mode 100644 index 2e42096c9664f3c8f496ec964d9989c551bda910..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3446 zcmV-+4TPx?FiAu~RCt`_n|*LpR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K}f+Rk^3;2CroVE^R*^j;3wZ7&2sn;d1 z?J62W(kI$@!wh6O+v|3M-;W@OAc(j9+oOS3XFW~_u5KI1e*6d(wyTYc+AkdUeeYkM z?oGAWTkE|ZkM{$0Qu0oZ;P)s+g$d9Ax6kpg;Mfs_dWY-H_4e9hz0U6c Y0Sb~ou*ArFkN^Mx07*qoM6N<$f_ntYg8%>k diff --git a/DungeonAndDeamon/icon.png.import b/DungeonAndDeamon/icon.png.import deleted file mode 100644 index 96cbf46..0000000 --- a/DungeonAndDeamon/icon.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="StreamTexture" -path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://icon.png" -dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex" ] - -[params] - -compress/mode=0 -compress/lossy_quality=0.7 -compress/hdr_mode=0 -compress/bptc_ldr=0 -compress/normal_map=0 -flags/repeat=0 -flags/filter=true -flags/mipmaps=false -flags/anisotropic=false -flags/srgb=2 -process/fix_alpha_border=true -process/premult_alpha=false -process/HDR_as_SRGB=false -process/invert_color=false -stream=false -size_limit=0 -detect_3d=true -svg/scale=1.0 diff --git a/DungeonAndDeamon/script/Node2D.tscn b/DungeonAndDeamon/script/Node2D.tscn index 570ba0b..a4d0cdc 100644 --- a/DungeonAndDeamon/script/Node2D.tscn +++ b/DungeonAndDeamon/script/Node2D.tscn @@ -91,29 +91,9 @@ animations = [ { "name": "idle", "speed": 5.0 }, { -"frames": [ ExtResource( 53 ), ExtResource( 62 ), ExtResource( 43 ), ExtResource( 51 ) ], +"frames": [ ExtResource( 45 ), ExtResource( 41 ), ExtResource( 42 ), ExtResource( 63 ), ExtResource( 58 ), ExtResource( 59 ), ExtResource( 40 ), ExtResource( 55 ), ExtResource( 36 ) ], "loop": true, -"name": "degat", -"speed": 5.0 -}, { -"frames": [ ExtResource( 37 ), ExtResource( 60 ), ExtResource( 61 ), ExtResource( 50 ), ExtResource( 38 ), ExtResource( 33 ), ExtResource( 39 ) ], -"loop": true, -"name": "jump", -"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 -}, { -"frames": [ ExtResource( 65 ), ExtResource( 81 ), ExtResource( 76 ), ExtResource( 70 ), ExtResource( 68 ) ], -"loop": true, -"name": "degat shield", -"speed": 5.0 -}, { -"frames": [ ExtResource( 25 ), ExtResource( 22 ), ExtResource( 31 ), ExtResource( 28 ), ExtResource( 26 ), ExtResource( 23 ), ExtResource( 27 ), ExtResource( 30 ), ExtResource( 24 ), ExtResource( 29 ), ExtResource( 32 ), ExtResource( 45 ) ], -"loop": true, -"name": "attack01", +"name": "attack02", "speed": 5.0 }, { "frames": [ ExtResource( 57 ), ExtResource( 52 ), ExtResource( 69 ), ExtResource( 64 ), ExtResource( 78 ), ExtResource( 73 ), ExtResource( 65 ) ], @@ -121,9 +101,19 @@ animations = [ { "name": "shield", "speed": 5.0 }, { -"frames": [ ExtResource( 71 ), ExtResource( 66 ), ExtResource( 67 ), ExtResource( 72 ), ExtResource( 74 ), ExtResource( 77 ), ExtResource( 80 ), ExtResource( 79 ), ExtResource( 75 ) ], +"frames": [ ExtResource( 53 ), ExtResource( 62 ), ExtResource( 43 ), ExtResource( 51 ) ], "loop": true, -"name": "roulade", +"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 +}, { +"frames": [ ExtResource( 25 ), ExtResource( 22 ), ExtResource( 31 ), ExtResource( 28 ), ExtResource( 26 ), ExtResource( 23 ), ExtResource( 27 ), ExtResource( 30 ), ExtResource( 24 ), ExtResource( 29 ), ExtResource( 32 ), ExtResource( 45 ) ], +"loop": true, +"name": "attack01", "speed": 5.0 }, { "frames": [ ExtResource( 33 ), ExtResource( 38 ), ExtResource( 33 ), ExtResource( 39 ), ExtResource( 38 ), ExtResource( 50 ) ], @@ -131,15 +121,25 @@ animations = [ { "name": "fall", "speed": 5.0 }, { -"frames": [ ExtResource( 45 ), ExtResource( 41 ), ExtResource( 42 ), ExtResource( 63 ), ExtResource( 58 ), ExtResource( 59 ), ExtResource( 40 ), ExtResource( 55 ), ExtResource( 36 ) ], +"frames": [ ExtResource( 71 ), ExtResource( 66 ), ExtResource( 67 ), ExtResource( 72 ), ExtResource( 74 ), ExtResource( 77 ), ExtResource( 80 ), ExtResource( 79 ), ExtResource( 75 ) ], "loop": true, -"name": "attack02", +"name": "roulade", +"speed": 5.0 +}, { +"frames": [ ExtResource( 37 ), ExtResource( 60 ), ExtResource( 61 ), ExtResource( 50 ), ExtResource( 38 ), ExtResource( 33 ), ExtResource( 39 ) ], +"loop": true, +"name": "jump", "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( 65 ), ExtResource( 81 ), ExtResource( 76 ), ExtResource( 70 ), ExtResource( 68 ) ], +"loop": true, +"name": "degat shield", +"speed": 5.0 } ] [node name="Stageone" type="Node2D"] @@ -173,6 +173,7 @@ shape = SubResource( 1 ) [node name="AnimatedSprite" type="AnimatedSprite" parent="Player"] frames = SubResource( 2 ) animation = "fall" +frame = 2 playing = true [node name="TileMap" type="TileMap" parent="."] diff --git a/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.cpp b/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.cpp index 70e6d4d..4f0e3de 100644 --- a/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.cpp +++ b/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.cpp @@ -84,27 +84,40 @@ void GestionPlayer::setupPlayer() void GestionPlayer::traitementInput() { p.velocity = Vector2(0, 0); + FLOOR = Vector2(0, -1); Input* i = Input::get_singleton(); if (i->is_action_pressed("ui_left")) gauche(); - else if (i->is_action_pressed("ui_right")) + if (i->is_action_pressed("ui_right")) droit(); - else if (i->is_key_pressed(0x39)) + if (i->is_action_pressed("ui_select")) saut(); + + + + + if (is_on_floor()) { + on_ground = true; + p.velocity.y += 0; + } + else { + on_ground = false; + p.velocity.y += gravity; + } } void GestionPlayer::droit() { Godot::print("Deplacement a droite"); - p.velocity.x -= p.speed; + p.velocity.x += speed; } void GestionPlayer::gauche() { Godot::print("Deplacement a gauche"); - p.velocity.x += p.speed; + p.velocity.x -= speed; } void GestionPlayer::bas() @@ -114,10 +127,13 @@ void GestionPlayer::bas() void GestionPlayer::saut() { + p.velocity.y = power_jump; + } void GestionPlayer::idle() { + p.velocity.x = 0.0; } void GestionPlayer::attack() diff --git a/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.h b/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.h index cf21f33..b8314ca 100644 --- a/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.h +++ b/DungeonAndDeamonScript/DungeonAndDemaonScript/GestionPlayer.h @@ -43,4 +43,17 @@ public: void saut(); void idle(); void attack(); +public: + const int speed = 100; + const int gravity = 90; + const int power_jump = -250; + bool on_ground = false; + bool right; + bool left; + bool jump; + + +private: + Vector2 velocity; + Vector2 FLOOR; }; \ No newline at end of file