.include "cpctelera.h.s"
.include "cmp/entity.h.s"
.include "sys/physics.h.s"
.include "sys/render.h.s"
.include "sys/input.h.s"
.include "sys/collision.h.s"
.include "man/entity.h.s"

.include "assets/assets.h.s"


.module game_manager

ent2: DefineCmp_entity e_cmp_Physics, 40, 180, 0xFF, 0xFE, 20, 16, _spr_ejemplo


ent3: DefineCmp_entity e_cmp_Enemy, 70, 50, 0xFF, 0, 8, 16, _spr_bomba
ent4: DefineCmp_entity e_cmp_Enemy, 50, 100, 0xFF, 0, 8, 16, _spr_bomba
ent5: DefineCmp_entity e_cmp_Enemy, 10, 20, 0xFF, 0, 8, 16, _spr_bomba



ent6: DefineCmp_entity e_cmp_Physics, 70, 5, 0xFF, 0, 10, 16, _spr_pez
ent7: DefineCmp_entity e_cmp_Physics, 10, 80, 0xFF, 0, 10, 16, _spr_pez
ent8: DefineCmp_entity e_cmp_Physics, 50, 120, 0xFF, 0, 10, 16, _spr_pez




man_game_init::

	call man_entity_init
	call man_entity_getArray
	call sys_eren_init
	call sys_tilemap_init
	call sys_physics_init
	call sys_input_init
	call sys_collision_init


	ld hl, #ent2
	call man_entity_create

	ld hl, #ent3
	call man_entity_create
	ld hl, #ent4
	call man_entity_create
	ld hl, #ent5
	call man_entity_create

	ld hl, #ent6
	call man_entity_create
	ld hl, #ent7
	call man_entity_create
	ld hl, #ent8
	call man_entity_create
	
;;	ld hl, #ent9
;;	call man_entity_create
;;	ld hl, #ent10
;;	call man_entity_create

	ret


man_game_render::
	call man_entity_getArray
	;;call sys_eren_update
	call sys_eren_render_entities
	ret


man_game_update::

	call man_entity_getArray
	call man_entity_generate
	call man_entity_getArray
	;;call sys_input_update
	call sys_input_update_one
	call man_entity_getArray
	;;call sys_physics_update
	call sys_physics_update_one
	call man_entity_update
	call sys_collision_update

	

	ret