Browse Source

player apparence (path)

master
pedroBzh 1 month ago
parent
commit
ed2e54bf51
11 changed files with 456 additions and 439 deletions
  1. BIN
      assets-fx/img/numbers.png
  2. BIN
      assets-fx/img/tilemap.png
  3. BIN
      binnword.g1a
  4. BIN
      build-fx/assets/img/numbers.png.o
  5. BIN
      build-fx/assets/img/tilemap.png.o
  6. BIN
      build-fx/binnword.bin
  7. BIN
      build-fx/binnword.elf
  8. +437
    -432
      build-fx/map
  9. BIN
      build-fx/src/main.c.o
  10. +1
    -0
      project.cfg
  11. +18
    -7
      src/main.c

BIN
assets-fx/img/numbers.png View File

Before After
Width: 39  |  Height: 5  |  Size: 134 B Width: 49  |  Height: 7  |  Size: 149 B

BIN
assets-fx/img/tilemap.png View File

Before After
Width: 215  |  Height: 30  |  Size: 393 B Width: 215  |  Height: 30  |  Size: 393 B

BIN
binnword.g1a View File


BIN
build-fx/assets/img/numbers.png.o View File


BIN
build-fx/assets/img/tilemap.png.o View File


BIN
build-fx/binnword.bin View File


BIN
build-fx/binnword.elf View File


+ 437
- 432
build-fx/map
File diff suppressed because it is too large
View File


BIN
build-fx/src/main.c.o View File


+ 1
- 0
project.cfg 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 :=

+ 18
- 7
src/main.c 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;


Loading…
Cancel
Save