player apparence (path)

This commit is contained in:
pedroBzh 2020-11-30 13:07:18 +01:00
parent 997cc6d36a
commit ed2e54bf51
11 changed files with 456 additions and 439 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -87,3 +87,4 @@ LDFLAGS_CG += -Wl,-Map=build-cg/map
#
# FONT.hexa.png = charset:print grid.size:3x5 grid.padding:1
IMG.tilemap.png :=
IMG.numbers.png :=

View File

@ -3,14 +3,15 @@ extern "C"{
#include <gint/keyboard.h>
//#include <gint/std/string.h>
}
#define MAP_X 100
#define MAP_X 200
#define BLOCKS_LEN 17
using namespace std;
int sx = 0;
int x = 100;
int y = 30;
extern bopti_image_t img_tilemap;
extern bopti_image_t img_numbers;
int game_map[MAP_X+1][7] = {0};
int opt = GETKEY_DEFAULT | GETKEY_REP_ARROWS | GETKEY_MENU;
int optd = GETKEY_DEFAULT | GETKEY_MENU;
@ -23,6 +24,8 @@ int vdir;
int sele = 2;
int vas = 0;
int sinv = 3;
int inv[BLOCKS_LEN+1] = {0};
int btmp = sinv;
int isCollide(int num){
if(num==0){return 1;}
@ -51,8 +54,9 @@ void PrintSblock(int num,int x,int y){
void PrintMap(){
int cx = MAP_X;
int cy = 6;
dsubimage(118, 0 ,&img_tilemap,sinv*10,0,10, 10, DIMAGE_NONE);
dhline(11,C_BLACK);
dsubimage(116, 0 ,&img_tilemap,sinv*10,0,10, 10, DIMAGE_NONE);
dhline(12,C_BLACK);
dprint(96, 0, C_BLACK, "%d", inv[sinv]);
while(cx>0){
cy = 6;
while(cy>0){
@ -66,8 +70,8 @@ void PrintMap(){
}
cx--;
}
if(dir==0){dsubimage(x-sx, y+4 ,&img_tilemap,5*10,0,10, 10, DIMAGE_NONE);}
if(dir==1){dsubimage(x-sx, y+4 ,&img_tilemap,4*10,0,10, 10, DIMAGE_NONE);}
if(dir==0){dsubimage(x-sx, y+4 ,&img_tilemap,5*10,20,10, 10, DIMAGE_NONE);}
if(dir==1){dsubimage(x-sx, y+4 ,&img_tilemap,4*10,20,10, 10, DIMAGE_NONE);}
if(vas==0&& (keydown(KEY_VARS) || keydown(KEY_SQUARE))){
if(sele==1){dsubimage(x+10-sx, y+4 ,&img_tilemap,0,20,10, 10, DIMAGE_NONE);}
if(sele==2){dsubimage(x-sx, y+4+10 ,&img_tilemap,0,20,10, 10, DIMAGE_NONE);}
@ -105,6 +109,9 @@ int main(void)
game_map[5][3] = 9;
game_map[6][3] = 10;
game_map[7][3] = 11;
inv[3] = 15;
inv[13] = 10;
inv[17] = 5;
while(1==1){
if(keydown(KEY_OPTN)){vas=1;}else{vas=0;}
sx = x-60;
@ -113,7 +120,7 @@ int main(void)
PrintMap();
dupdate();
key = getkey_opt(opt, &timeout).key;
if(keydown(KEY_VARS)==0&&can_move == 1 && game_map[x/10][y/10+1] != 0){
if(keydown(KEY_VARS)==0&&can_move == 1 && isCollide(game_map[x/10][y/10+1]) == 0){
if(keydown(KEY_RIGHT)&&isCollide(game_map[x/10+1][y/10])){rwalk = 10;can_move=0;dir=1;vdir=1;}
if(keydown(KEY_LEFT)&&isCollide(game_map[x/10-1][y/10])){rwalk = 10;can_move=0;dir=0;vdir=3;}
}
@ -135,6 +142,10 @@ int main(void)
if(sele==3){game_map[x/10-1][y/10]=0;}
if(sele==0){game_map[x/10][y/10-1]=0;}
}
if(keydown(KEY_F6)){
if(sinv==BLOCKS_LEN+1){sinv=0;}
sinv++;
}
if(can_move == 1 && game_map[x/10][y/10+1] == 0){
can_move = 0;
rwalk=10;