mirror of
https://github.com/zoriya/ForecastingVillage.git
synced 2026-05-28 00:51:33 +00:00
Merge branch 'master' of github.com:AnonymusRaccoon/ForecastingVillage
This commit is contained in:
+1
-1
@@ -298,7 +298,7 @@ add_executable(my_rpg
|
||||
include/components/attack_component.h
|
||||
src/systems/combat_methods.c
|
||||
src/combat/fireball.c
|
||||
)
|
||||
src/player_utilities.c include/player_utilities.h)
|
||||
|
||||
add_compile_options(-W -Wall -Wextra -Wshadow)
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2019
|
||||
** MUL_my_runner_2019
|
||||
** File description:
|
||||
** game_loader
|
||||
*/
|
||||
|
||||
#ifndef MY_RPG_PLAYER_UTILITIES_H
|
||||
#define MY_RPG_PLAYER_UTILITIES_H
|
||||
|
||||
#include "entity.h"
|
||||
|
||||
void set_combat_player(gc_entity *main_player, gc_entity *combat_player);
|
||||
|
||||
#endif //MY_RPG_PLAYER_UTILITIES_H
|
||||
@@ -52,8 +52,5 @@
|
||||
<text text="Loading" x="80%" y="65%" centered="false">
|
||||
<game_display stats="health"/>
|
||||
</text>
|
||||
<text text="Loading" x="80%" y="71%" centered="false">
|
||||
<game_display stats="xp"/>
|
||||
</text>
|
||||
</gc_entities>
|
||||
</gc_scene>
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2019
|
||||
** MUL_my_runner_2019
|
||||
** File description:
|
||||
** game_loader
|
||||
*/
|
||||
|
||||
#include "components//health_component.h"
|
||||
#include "entity.h"
|
||||
|
||||
void set_combat_player(gc_entity *main_player, gc_entity *combat_player)
|
||||
{
|
||||
struct health_component *h_cmp_main = \
|
||||
GETCMP(main_player, health_component);
|
||||
struct health_component *h_cmp_combat = \
|
||||
GETCMP(combat_player, health_component);
|
||||
|
||||
if (!h_cmp_main || !h_cmp_combat)
|
||||
return;
|
||||
h_cmp_combat->health_max = h_cmp_main->health_max;
|
||||
h_cmp_combat->health = h_cmp_main->health;
|
||||
h_cmp_combat->dead = h_cmp_main->dead;
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "my.h"
|
||||
#include "components/dialog_holder.h"
|
||||
#include "enemy.h"
|
||||
#include "player_utilities.h"
|
||||
|
||||
void entity_moved(gc_engine *engine, va_list args)
|
||||
{
|
||||
@@ -31,9 +32,12 @@ void entity_moved(gc_engine *engine, va_list args)
|
||||
void dialog_ended(gc_engine *engine, va_list args)
|
||||
{
|
||||
struct combat_manager *this = GETSYS(engine, combat_manager);
|
||||
gc_entity *player = engine->scene->get_entity(engine->scene, 50);
|
||||
gc_entity *player_combat = this->game_scene->get_entity(this->game_scene, 50);
|
||||
|
||||
if (!this->current_enemy)
|
||||
if (!this->current_enemy || !player || ! player_combat)
|
||||
return;
|
||||
set_combat_player(player_combat, player);
|
||||
engine->trigger_event(engine, "combat_ended", this->current_enemy);
|
||||
this->current_enemy = NULL;
|
||||
engine->change_scene(engine, this->game_scene);
|
||||
|
||||
@@ -17,20 +17,7 @@
|
||||
#include "components/health_component.h"
|
||||
#include "enemy.h"
|
||||
#include "setup.h"
|
||||
|
||||
void set_combat_player(gc_entity *main_player, gc_entity *combat_player)
|
||||
{
|
||||
struct health_component *h_cmp_main = \
|
||||
GETCMP(main_player, health_component);
|
||||
struct health_component *h_cmp_combat = \
|
||||
GETCMP(combat_player, health_component);
|
||||
|
||||
if (!h_cmp_main || !h_cmp_combat)
|
||||
return;
|
||||
h_cmp_combat->health_max = h_cmp_main->health_max;
|
||||
h_cmp_combat->health = h_cmp_main->health;
|
||||
h_cmp_combat->dead = h_cmp_main->dead;
|
||||
}
|
||||
#include "player_utilities.h"
|
||||
|
||||
void combat_start(gc_engine *engine, char *enemy_name)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user