- Es pot canviar el color de l'habitació

This commit is contained in:
2023-06-06 19:46:57 +02:00
parent e75eae0c7e
commit f21029f973
4 changed files with 11 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -13,11 +13,12 @@ int room_xp = -1;
int room_xn = -1;
int room_yp = -1;
int room_yn = -1;
int room_color = 5;
void restart()
{
actor::clear();
room::load(room_w, room_h, room_xp, room_xn, room_yp, room_yn);
room::load(room_w, room_h, room_xp, room_xn, room_yp, room_yn, room_color);
/*
box = actor::create("ASCENSOR",{16,32,0}, {8,8,4}, {64,0,32,24}, {0,24});
@@ -113,6 +114,7 @@ bool game::loop()
btn("DOOR XN:", 330, 65, room_xn, -1, 5);
btn("DOOR YP:", 330, 80, room_yp, -1, 5);
btn("DOOR YN:", 330, 95, room_yn, -1, 5);
btn("COLOR:", 330, 110, room_color, 3, 7);
draw::render();

View File

@@ -12,9 +12,11 @@ namespace room
static uint8_t doors = DOOR_XP /*| DOOR_YP*/ ;
static uint8_t door_height[4];
static uint8_t color = 5;
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn)
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn, uint8_t col)
{
color = col;
size = {(x+1)*2,(y+1)*2,3};
tmin = {3-x,3-y,0};
tmax = {4+x,4+y,3};
@@ -49,6 +51,8 @@ namespace room
void draw()
{
draw::swapcol(1, color);
// RUTINES DE PINTAT DE LA PORTA DE DALT A LA DRETA
if (doors & DOOR_YN)
{
@@ -112,6 +116,8 @@ namespace room
void draw2()
{
draw::swapcol(1, color);
if (doors & DOOR_YP)
{
// Pintem les voreres dels dos tiles extra per a la porta YP

View File

@@ -13,7 +13,7 @@
namespace room
{
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn);
void load(int x, int y, int8_t xp, int8_t xn, int8_t yp, int8_t yn, uint8_t col);
void draw();
void draw2();