20220724 - Préparation du crafting. amélioration, ajout de quelque sprites.

This commit is contained in:
mibi88 2022-07-24 12:44:49 +02:00
parent 283b3e6248
commit 0db6dd3238
10 changed files with 59 additions and 17 deletions

View File

@ -41,7 +41,8 @@ set(ASSETS_fx
assets-fx/tiles/blocks/water2.png
assets-fx/tiles/blocks/wheat.png
assets-fx/tiles/blocks/woodplks.png
assets-fx/tiles/blocks/woodstep.png
assets-fx/tiles/blocks/woodstep1.png
assets-fx/tiles/blocks/woodstep2.png
assets-fx/player/skin1/player0.png
assets-fx/player/skin1/player1.png
assets-fx/player/skin1/player2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 B

After

Width:  |  Height:  |  Size: 120 B

View File

@ -79,6 +79,12 @@ wheat.png:
woodplks.png:
type: bopti-image
name: woodplanks_tile
woodstep.png:
woodstep1.png:
type: bopti-image
name: woodsteps_tile
name: woodsteps_1_tile
woodstep2.png:
type: bopti-image
name: woodsteps_2_tile
woodstick.png:
type: bopti-image
name: woodstick_tile

View File

Before

Width:  |  Height:  |  Size: 94 B

After

Width:  |  Height:  |  Size: 94 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

View File

@ -3,4 +3,6 @@
# define WORLDGEN_SOIL 8 // Blocks (y) of soil.
# define WORLD_WIDTH 64 // World width.
# define WORLD_HEIGHT 64 // World height.
# define INVENTORY_SIZE 5 // Size of the inventory.
# define INVENTORY_SIZE 5 // Size of the inventory.
# define CRAFTSIZE 9 // How many different blocks you can use to craft something.
# define CRAFTINGS 3 // How many things you can craft.

View File

@ -17,6 +17,10 @@ extern bopti_image_t stone_tile;
extern bopti_image_t coal_tile;
extern bopti_image_t steel_tile;
extern bopti_image_t wood_tile;
extern bopti_image_t woodplanks_tile;
extern bopti_image_t woodsteps_1_tile;
extern bopti_image_t woodsteps_2_tile;
extern bopti_image_t woodstick_tile;
extern bopti_image_t skin1_player_left1;
extern bopti_image_t skin1_player_left2;
extern bopti_image_t skin1_player_right1;
@ -24,12 +28,15 @@ extern bopti_image_t skin1_player_right2;
extern bopti_image_t select_tool;
extern bopti_image_t invnormal;
extern bopti_image_t invselected;
extern bopti_image_t craftselection;
extern bopti_image_t arrow_1;
extern bopti_image_t arrow_2;
extern bopti_image_t overlay_break_1;
extern bopti_image_t overlay_break_2;
extern bopti_image_t overlay_break_3;
extern bopti_image_t overlay_break_4;
# include "player.h"
# include "objects.h"
//int x, y, pos, hour, animation, orient, timing, falling, jumping, jumpheight;
int pos, hour;
@ -223,6 +230,11 @@ void drawdetailinv(){
}
}
}
void drawcrafting(){
dimage(32, 0, &craftselection);
dimage(4, 28, &arrow_2);
dimage(116, 28, &arrow_1);
}
int main(void) {
dclear(C_WHITE);
dimage(16, TITLE_IMAGE_MARGIN, &title_img);
@ -431,6 +443,9 @@ int main(void) {
clearevents();
if(keydown(KEY_MENU)){
game = 4;
while(keydown(KEY_MENU)){
clearevents();
}
}
// dtext(1, 1, C_BLACK, "test");
mappartdisplaying(player.x, player.y, terrain, player.orient+player.animation);
@ -454,10 +469,10 @@ int main(void) {
while(keydown(KEY_EXE)){
clearevents();
}
}else if(keydown(KEY_1)){
}else if(keydown(KEY_MENU)){
game = 5;
clearevents();
while(keydown(KEY_1)){
while(keydown(KEY_MENU)){
clearevents();
}
}
@ -524,6 +539,7 @@ int main(void) {
}
}else if(game == 5){
dclear(C_WHITE);
drawcrafting();
dupdate();
clearevents();
if(keydown(KEY_EXE)){
@ -534,17 +550,13 @@ int main(void) {
}
}
clearevents();
if (keydown(KEY_0)){
if(player.invselect<INVENTORY_SIZE-1){
player.invselect++;
}else{
player.invselect = 0;
if (keydown(KEY_LEFT)){
while(keydown(KEY_LEFT)){
clearevents();
}
dclear(C_WHITE);
drawdetailinv();
dupdate();
clearevents();
while(keydown(KEY_0)){
}
if (keydown(KEY_RIGHT)){
while(keydown(KEY_RIGHT)){
clearevents();
}
}

View File

@ -22,4 +22,25 @@ struct Player{
int old_select_ty;
int wasdestroyingbefore;
int destroytime;
};
typedef struct Crafting Crafting;
struct Crafting{
int selected;
int ispossible;
};
const int craftingsitems[CRAFTINGS*CRAFTSIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
};
const int craftingsnum[CRAFTINGS*CRAFTSIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
};
const int craftingitem[CRAFTINGS] = {
0,
0,
0
};