From 1a5fcc223f4858815118b175288aa6b1b734c690 Mon Sep 17 00:00:00 2001 From: suruq Date: Wed, 15 Jun 2016 17:47:10 +0200 Subject: [PATCH] scrip nouveau monstre completr --- Sprites.hpp | 34 +++++++--------------------------- monstres.cpp | 17 ++++++++++++++++- monstres.hpp | 2 +- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/Sprites.hpp b/Sprites.hpp index 367eac7..95abc9b 100644 --- a/Sprites.hpp +++ b/Sprites.hpp @@ -112,59 +112,39 @@ const unsigned char SacPV0[]={0xff, 0xc7, 0xd7, 0x83, 0xbb, 0x83, 0xff, 0xff, }; -const unsigned char SacPV1[]={0xff, 0xc7, 0xd7, 0x83, 0xbb, 0x83, 0xff, 0xff, }; -const unsigned char SacPV2[]={0xff, 0xc7, 0xd7, 0x83, 0xbb, 0x83, 0xff, 0xff, }; const unsigned char SacPV3[]={0xff, 0xc7, 0xc7, 0x83, 0x83, 0x83, 0xff, 0xff, }; -const unsigned char SacPV4[]={0xff, 0xc7, 0xc7, 0x83, 0x83, 0x83, 0xff, 0xff, }; -const unsigned char SacPV5[]={0xff, 0xc7, 0xc7, 0x83, 0x83, 0x83, 0xff, 0xff, }; const unsigned char SacPV6[]={0xff, 0xc7, 0xc7, 0x8b, 0x83, 0x83, 0xff, 0xff, }; -const unsigned char SacPV7[]={0xff, 0xc7, 0xc7, 0x8b, 0x83, 0x83, 0xff, 0xff, }; -const unsigned char SacPV8[]={0xff, 0xc7, 0xc7, 0x8b, 0x83, 0x83, 0xff, 0xff, }; const unsigned char SacPV0_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6c, }; -const unsigned char SacPV1_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x60, }; -const unsigned char SacPV2_n[]={0x39, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd, }; const unsigned char SacPV3_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6c, }; -const unsigned char SacPV4_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc, }; - -const unsigned char SacPV5_n[]={0x39, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff, 0x61, }; const unsigned char SacPV6_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x38, }; -const unsigned char SacPV7_n[]={0x38, 0x7c, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2c, }; - -const unsigned char SacPV8_n[]={0x39, 0x7d, 0xff, 0xff, 0xff, 0xff, 0xff, 0x35, }; - Sprite S_SacPV0 (SacPV0,SacPV0_n ,7,8); -Sprite S_SacPV1 (SacPV1, SacPV1_n,7,8); -Sprite S_SacPV2 (SacPV2, SacPV2_n,7,8); + Sprite S_SacPV3 (SacPV3, SacPV3_n,7,8); -Sprite S_SacPV4 (SacPV4,SacPV4_n ,7,8); -Sprite S_SacPV5 (SacPV5, SacPV5_n,7,8); + Sprite S_SacPV6 (SacPV6,SacPV6_n ,7,8);S_SacPV6.CreateReverse(); -Sprite S_SacPV7 (SacPV7,SacPV7_n ,7,8);S_SacPV7.CreateReverse(); -Sprite S_SacPV8 (SacPV8,SacPV8_n ,7,8);S_SacPV8.CreateReverse(); -Sprite S_Sac_avant[]={S_SacPV0,S_SacPV1,S_SacPV2}; -Sprite S_Sac_arriere[]={S_SacPV3,S_SacPV4,S_SacPV5}; -Sprite S_Sac_cote[]={S_SacPV6,S_SacPV7,S_SacPV8}; -Animation A_Sac_avant(S_Sac_avant,3,200); -Animation A_Sac_arriere(S_Sac_arriere,3,200); -Animation A_Sac_cote(S_Sac_cote,3,200); + + +Animation A_Sac_avant(S_SacPV0); +Animation A_Sac_arriere(S_SacPV3); +Animation A_Sac_cote(S_SacPV6); Animation A_SacPV[]={A_Sac_avant,A_Sac_arriere,A_Sac_cote}; diff --git a/monstres.cpp b/monstres.cpp index 4108665..c28edaf 100644 --- a/monstres.cpp +++ b/monstres.cpp @@ -35,15 +35,30 @@ void IaSlime::Update() void IaSacPV::Start() { - + GetObject()->AddRigidBody(); +int vie=5; + Direction = 0; } void IaSacPV::UpdateEverySecond() { + Direction = rand_int_ab(1, 5); + switch(Direction) + { + case 1 : GetObject()->GetRigidBody()->Move(0,3);GetObject()->GetRender()->SetIt(1);break; + case 4 : GetObject()->GetRigidBody()->Move(3,0);GetObject()->GetRender()->SetIt(2);GetObject()->GetRender()->ReverseRender(true); break; + case 3 : GetObject()->GetRigidBody()->Move(0,-3);GetObject()->GetRender()->SetIt(0);break; + case 2 : GetObject()->GetRigidBody()->Move(-3,0);GetObject()->GetRender()->SetIt(2);GetObject()->GetRender()->ReverseRender(false); break; + } } void IaSacPV::Update() { +if(GetObject()->GetCollisionTag("Epee")) + { + vie--; + } +if (vie<=0)GetEngine()->DelObject(GetObject()); } diff --git a/monstres.hpp b/monstres.hpp index 5eea90d..21996f3 100644 --- a/monstres.hpp +++ b/monstres.hpp @@ -23,7 +23,7 @@ class IaSacPV: public Script void Start(); void UpdateEverySecond(); void Update(); - + int vie; int Direction; };