Finished sped potion, began work on regen potion and brewing tutorial

This commit is contained in:
ElijahZAwesome 2018-01-22 17:07:55 -06:00
parent f34ebde15b
commit 960982e4ab
10 changed files with 108 additions and 16 deletions

View file

@ -110,6 +110,7 @@ ifeq ($(strip $(ICON)),)
export APP_ICON := $(TOPDIR)/$(TARGET).png export APP_ICON := $(TOPDIR)/$(TARGET).png
else else
ifneq (,$(findstring icons-banners/icon.png,$(icons))) ifneq (,$(findstring icons-banners/icon.png,$(icons)))
ifneq (,$(findstring /icons-banners/icon.png,$(icons)))
export APP_ICON := $(TOPDIR)/icons-banners/icon.png export APP_ICON := $(TOPDIR)/icons-banners/icon.png
endif endif
endif endif

View file

@ -152,9 +152,10 @@ void initRecipes(){
enchanterRecipes.recipes[6] = defineRecipe(ITEM_WALL_GEM,1,1,ITEM_GEM,10); enchanterRecipes.recipes[6] = defineRecipe(ITEM_WALL_GEM,1,1,ITEM_GEM,10);
enchanterRecipes.recipes[7] = defineRecipe(ITEM_GOLD_APPLE,1,2,ITEM_APPLE,1,ITEM_GOLDINGOT,15); enchanterRecipes.recipes[7] = defineRecipe(ITEM_GOLD_APPLE,1,2,ITEM_APPLE,1,ITEM_GOLDINGOT,15);
potionMakerRecipes.size = 1; potionMakerRecipes.size = 2;
potionMakerRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (potionMakerRecipes.size)); potionMakerRecipes.recipes = (Recipe*)malloc(sizeof(Recipe) * (potionMakerRecipes.size));
potionMakerRecipes.recipes[0] = defineRecipe(ITEM_STRENGTH_POTION,1,3,ITEM_GOLD_APPLE,1,ITEM_GLASS,10,ITEM_IRONINGOT,10); potionMakerRecipes.recipes[0] = defineRecipe(ITEM_STRENGTH_POTION,1,3,ITEM_GOLD_APPLE,1,ITEM_GLASS,10,ITEM_IRONINGOT,10);
potionMakerRecipes.recipes[1] = defineRecipe(ITEM_SPEED_POTION,1,4,ITEM_GEM,2,ITEM_GLASS,10,ITEM_IRONINGOT,10, ITEM_GOLDINGOT,15);
} }

View file

@ -45,7 +45,9 @@ typedef struct {
bool isCarrying; bool isCarrying;
bool isSwimming; bool isSwimming;
int swimTimer; int swimTimer;
int regenTimer;
int strengthTimer; int strengthTimer;
int speedTimer;
int score; int score;
Inventory* inv; Inventory* inv;
Item* activeItem; Item* activeItem;

View file

@ -5,6 +5,8 @@ char versionText[34] = "Version 1.3.2";
char fpsstr[34]; char fpsstr[34];
u8 currentMenu = 0; u8 currentMenu = 0;
bool UnderStrengthEffect = false; bool UnderStrengthEffect = false;
bool UnderSpeedEffect = false;
bool regening = false;
void addItemsToWorld(Item item,int x, int y, int count){ void addItemsToWorld(Item item,int x, int y, int count){
int i; int i;
@ -691,6 +693,9 @@ void healPlayer(int amount){
void strengthPotionEffect() { void strengthPotionEffect() {
UnderStrengthEffect = true; UnderStrengthEffect = true;
} }
void speedPotionEffect() {
UnderSpeedEffect = true;
}
s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir){
@ -718,6 +723,12 @@ s8 itemTileInteract(int tile, Item* item, int x, int y, int px, int py, int dir)
strengthPotionEffect(); strengthPotionEffect();
--item->countLevel; --item->countLevel;
} }
return 0;
case ITEM_SPEED_POTION:
if(player.p.health < 20 && playerUseEnergy(2) && player.p.strengthTimer == 0){
speedPotionEffect();
--item->countLevel;
}
return 0; return 0;
case ITEM_GOLD_APPLE: case ITEM_GOLD_APPLE:
if(player.p.health < 10 && playerUseEnergy(1)){ if(player.p.health < 10 && playerUseEnergy(1)){
@ -1681,6 +1692,7 @@ void initPlayer(){
addItemToInventory(newItem(ITEM_GOLD_APPLE,1), player.p.inv); addItemToInventory(newItem(ITEM_GOLD_APPLE,1), player.p.inv);
addItemToInventory(newItem(ITEM_POTION_MAKER,0), player.p.inv); addItemToInventory(newItem(ITEM_POTION_MAKER,0), player.p.inv);
addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), player.p.inv); addItemToInventory(newItem(ITEM_STRENGTH_POTION,1), player.p.inv);
addItemToInventory(newItem(ITEM_SPEED_POTION,1), player.p.inv);
addItemToInventory(newItem(TOOL_SHOVEL,4), player.p.inv); addItemToInventory(newItem(TOOL_SHOVEL,4), player.p.inv);
addItemToInventory(newItem(TOOL_HOE,4), player.p.inv); addItemToInventory(newItem(TOOL_HOE,4), player.p.inv);
addItemToInventory(newItem(TOOL_SWORD,4), player.p.inv); addItemToInventory(newItem(TOOL_SWORD,4), player.p.inv);
@ -2183,24 +2195,48 @@ void tickPlayer(){
player.p.ay = 0; player.p.ay = 0;
if (k_left.down){ if (k_left.down){
player.p.ax -= 1; if (!UnderSpeedEffect) {
player.p.dir = 2; player.p.ax -= 1;
++player.p.walkDist; player.p.dir = 2;
++player.p.walkDist;
} else if (UnderSpeedEffect) {
player.p.ax -= 2;
player.p.dir = 2;
player.p.walkDist = player.p.walkDist + 2;
}
} }
if (k_right.down){ if (k_right.down){
player.p.ax += 1; if (!UnderSpeedEffect) {
player.p.dir = 3; player.p.ax += 1;
++player.p.walkDist; player.p.dir = 3;
++player.p.walkDist;
} else if (UnderSpeedEffect) {
player.p.ax += 2;
player.p.dir = 3;
player.p.walkDist = player.p.walkDist + 2;
}
} }
if (k_up.down){ if (k_up.down){
player.p.ay -= 1; if (!UnderSpeedEffect) {
player.p.dir = 1; player.p.ay -= 1;
++player.p.walkDist; player.p.dir = 1;
++player.p.walkDist;
} else if (UnderSpeedEffect) {
player.p.ay -= 2;
player.p.dir = 1;
player.p.walkDist = player.p.walkDist + 2;
}
} }
if (k_down.down){ if (k_down.down){
player.p.ay += 1; if (!UnderSpeedEffect) {
player.p.dir = 0; player.p.ay += 1;
++player.p.walkDist; player.p.dir = 0;
++player.p.walkDist;
} else if (UnderSpeedEffect) {
player.p.ay += 2;
player.p.dir = 0;
player.p.walkDist = player.p.walkDist + 2;
}
} }
if (player.p.staminaRechargeDelay % 2 == 0) moveMob(&player, player.p.ax, player.p.ay); if (player.p.staminaRechargeDelay % 2 == 0) moveMob(&player, player.p.ax, player.p.ay);
@ -2213,6 +2249,10 @@ void tickPlayer(){
} }
} }
if (regening && player.p.regenTimer % 60 == 0) {
if(!shouldRenderDebug) --healPlayer(1);
}
if (k_pause.clicked){ if (k_pause.clicked){
currentSelection = 0; currentSelection = 0;
currentMenu = MENU_PAUSED; currentMenu = MENU_PAUSED;
@ -2233,11 +2273,17 @@ void tickPlayer(){
} }
if(isSwimming()) ++player.p.swimTimer; if(isSwimming()) ++player.p.swimTimer;
if(regening) ++player.p.regenTimer;
if(UnderStrengthEffect) ++player.p.strengthTimer; if(UnderStrengthEffect) ++player.p.strengthTimer;
if(player.p.strengthTimer >= 2000) { if(player.p.strengthTimer >= 2000) {
player.p.strengthTimer = 0; player.p.strengthTimer = 0;
UnderStrengthEffect = false; UnderStrengthEffect = false;
} }
if(UnderSpeedEffect) ++player.p.speedTimer;
if(player.p.speedTimer >= 2000) {
player.p.speedTimer = 0;
UnderSpeedEffect = false;
}
if(player.p.attackTimer > 0) { if(player.p.attackTimer > 0) {
--player.p.attackTimer; --player.p.attackTimer;
} }

View file

@ -153,6 +153,7 @@ char* getItemName(int itemID, int countLevel){
case ITEM_APPLE: sprintf(currentName,"%d Apple", countLevel); return currentName; case ITEM_APPLE: sprintf(currentName,"%d Apple", countLevel); return currentName;
case ITEM_GOLD_APPLE: sprintf(currentName,"%d Golden Apple", countLevel); return currentName; case ITEM_GOLD_APPLE: sprintf(currentName,"%d Golden Apple", countLevel); return currentName;
case ITEM_STRENGTH_POTION: sprintf(currentName,"%d Strength Potion", countLevel); return currentName; case ITEM_STRENGTH_POTION: sprintf(currentName,"%d Strength Potion", countLevel); return currentName;
case ITEM_SPEED_POTION: sprintf(currentName,"%d Speed Potion", countLevel); return currentName;
case ITEM_COAL: sprintf(currentName,"%d Coal", countLevel); return currentName; case ITEM_COAL: sprintf(currentName,"%d Coal", countLevel); return currentName;
case ITEM_IRONORE: sprintf(currentName,"%d Iron ore", countLevel); return currentName; case ITEM_IRONORE: sprintf(currentName,"%d Iron ore", countLevel); return currentName;
case ITEM_GOLDORE: sprintf(currentName,"%d Gold ore", countLevel); return currentName; case ITEM_GOLDORE: sprintf(currentName,"%d Gold ore", countLevel); return currentName;
@ -302,6 +303,7 @@ char* getBasicItemName(int itemID, int countLevel){
case ITEM_MAGIC_DUST: return "Magic Dust"; case ITEM_MAGIC_DUST: return "Magic Dust";
case ITEM_COIN: return "Coin"; case ITEM_COIN: return "Coin";
case ITEM_STRENGTH_POTION: return "Strength Potion"; case ITEM_STRENGTH_POTION: return "Strength Potion";
case ITEM_SPEED_POTION: return "Speed Potion";
case TOOL_BUCKET: case TOOL_BUCKET:
switch(countLevel){ switch(countLevel){
case 1: return "Water Bucket"; case 1: return "Water Bucket";

View file

@ -74,6 +74,7 @@
#define ITEM_COIN 75 #define ITEM_COIN 75
#define ITEM_GOLD_APPLE 76 #define ITEM_GOLD_APPLE 76
#define ITEM_STRENGTH_POTION 77 #define ITEM_STRENGTH_POTION 77
#define ITEM_SPEED_POTION 78
#define TOOL_BUCKET 101 #define TOOL_BUCKET 101
#define TOOL_BOW 102 #define TOOL_BOW 102

View file

@ -1,7 +1,7 @@
#include "MenuTutorial.h" #include "MenuTutorial.h"
u8 pageNum = 0; u8 pageNum = 0;
u8 maxPageNum = 6; u8 maxPageNum = 7;
u32 biasedCirclePad(u32 in){ u32 biasedCirclePad(u32 in){
if(in & KEY_CPAD_UP) return KEY_CPAD_UP; if(in & KEY_CPAD_UP) return KEY_CPAD_UP;
@ -95,6 +95,14 @@ void renderTutorialPage(bool topScreen){
drawText("Mine gem ore to get gems",(400-24*12)/2,154); drawText("Mine gem ore to get gems",(400-24*12)/2,154);
drawText("It takes 4 ore and 1 coal to",(400-28*12)/2,190); drawText("It takes 4 ore and 1 coal to",(400-28*12)/2,190);
drawText("make an ingot inside a furnace",(400-30*12)/2,210); drawText("make an ingot inside a furnace",(400-30*12)/2,210);
break;
case 7: // Potion Brewing
drawTextColor("Brewing",(400-6*12)/2,40,0xFF007FBF);
drawText("Use the Potion Maker to make potions",(400-29*12)/2,74);
drawText("The potions give you abilities",(400-20*12)/2,94);
drawText("Like speed and strength",(400-22*12)/2,114);
drawText("They are hard to obtain",(400-22*12)/2,134);
drawText("So get to it!",(400-24*12)/2,154);
break; break;
} }
} else { } else {
@ -232,6 +240,34 @@ void renderTutorialPage(bool topScreen){
drawText(">",244,114); drawText(">",244,114);
render(130,36,136,144,0); // Iron Pickaxe render(130,36,136,144,0); // Iron Pickaxe
render(130,56,144,144,0); // Gold Pickaxe render(130,56,144,144,0); // Gold Pickaxe
break;
case 7: // Brewing
render16(23,32,464,48,0); // iron ore
render16(23,52,480,48,0); // gold ore
render16(23,72,496,48,0); // gem ore
renderb(41,38,88,152,0,ironColor); // Iron ore item
renderb(41,58,88,152,0,goldColor); // Gold ore item
render(41,78,112,152,0); // Gem item
drawText(">",104,74);
drawText(">",104,114);
drawText(">",104,154);
render16(60,32,112,128,0); // Furnace
render16(60,52,112,128,0); // Furnace
render16(60,72,240,128,0); // Enchanter
drawText(">",160,74);
drawText(">",160,114);
drawText(">",160,154);
renderb(88,36,96,152,0,ironColor); // Iron ingot item
renderb(88,56,96,152,0,goldColor); // Gold ingot item
renderb(88,76,152,144,0,goldColor); // Gem Pickaxe
drawText(">",200,74);
drawText(">",200,114);
render16(106,32,64,128,0); // Anvil
render16(106,52,64,128,0); // Anvil
drawText(">",244,74);
drawText(">",244,114);
render(130,36,136,144,0); // Iron Pickaxe
render(130,56,144,144,0); // Gold Pickaxe
break; break;
} }

View file

@ -1496,6 +1496,9 @@ void renderItemIcon(int itemID, int countLevel, int x, int y) {
case ITEM_STRENGTH_POTION: case ITEM_STRENGTH_POTION:
render(x, y, 184, 160, 0); render(x, y, 184, 160, 0);
break; break;
case ITEM_SPEED_POTION:
render(x, y, 191, 160, 0);
break;
case ITEM_SLIME: case ITEM_SLIME:
renderb(x, y, 88, 152, 0, 0xFF4DC04D); renderb(x, y, 88, 152, 0, 0xFF4DC04D);
break; break;

View file

@ -78,4 +78,4 @@ void freeSounds(){
linearFree(music_floor1_night.buffer); linearFree(music_floor1_night.buffer);
linearFree(music_floor23.buffer); linearFree(music_floor23.buffer);
linearFree(music_floor4.buffer); linearFree(music_floor4.buffer);
} }

View file

@ -322,7 +322,7 @@ int main() {
offsetY = 0; offsetY = 0;
if(shouldRenderDebug){ if(shouldRenderDebug){
sprintf(fpsstr, "FPS: %.0f X:%d Y:%d E:%d %d", sf2d_get_fps(), player.x, player.y, eManager.lastSlot[currentLevel], player.p.strengthTimer); sprintf(fpsstr, "FPS: %.0f X:%d Y:%d E:%d %d", sf2d_get_fps(), player.x, player.y, eManager.lastSlot[currentLevel], player.p.speedTimer);
drawText(fpsstr, 2, 225); drawText(fpsstr, 2, 225);
} }