yey game work UwU

This commit is contained in:
kin fuyuki 2026-02-23 19:44:17 -03:00
commit 06a763b0fa
No known key found for this signature in database
GPG key ID: 0E4E8E519FB71401
218 changed files with 164 additions and 35 deletions

View file

@ -0,0 +1,38 @@
#include "scenes/game.h"
tiny::ErrorLevel tiny::level{9};
PLATFORM platform=LINUX;
std::string androidpackage="kn.kinfuyuki.animatronical-q1a1";
class anim: public enginend::program {
public:
const char *CONF() override{return "SAVEFILE.TDF";}
void boot() override {
this->currentscene=new game;
SetConfigFlags(FLAG_VSYNC_HINT|FLAG_WINDOW_RESIZABLE);
InitWindow(380,240,"ani1");
currentscene->boot();
}
void tick() override {
if (IsKeyDown(KEY_LEFT_ALT)&&IsKeyDown(KEY_F4))shouldclose=true;
currentscene->tick();
}
void draw() override {
currentscene->draw();
}
void exit() override {
currentscene->exit();
}
};
int main() {
anim dagame;
dagame.boot();
tiny::startup("animatronical 1","0.1c");
tiny::fatal("/home/komi/src/cpp/allgames/animatronical/q1/a1/res/map/on/s/0.jpg");
while (!dagame.shouldclose) {
dagame.tick();
dagame.draw();
}
dagame.exit();
}

View file

@ -7,8 +7,7 @@ enum CURSORMODES {
LEFT=2,RIGHT=3,UP=4,DOWN=5,
FLASHLIGHT=6,INTERACT=7
};
#define LOADMAP LoadTexture(newpath.c_str());
struct entity {
char pos;
char dir;
@ -20,32 +19,53 @@ extern std::vector<std::vector<char>> map;
extern std::vector<char> opposites;
char moveentity(char pos,char dir,bool backwards);
char rotateentity(char pos,char dir, bool clockwise);
bool ifforward();bool ifbackward();bool ifleft();bool ifright();
extern std::vector<char> sides;
extern std::vector<std::string> lightlevel;
struct game:public enginend::scene {
// dir 1
std::string backgrounds1[17*2];
Texture2D vent1[(3*2)+1];
Texture2D bathroomdoorfront1[3]; // the last is the closet door lol.
int lightmode:2=1; // off, on, urcooked
std::string mappath;
// this is for quick loading but without weighting ram..
// yea the assets are small but i like optimization
Texture2D currenttex, fronttex,lefttex,righttex,backtex;
// now the entities
Texture2D uycatrozwalk,uycatrozrun,uycatrozcrawl;
Texture2D skailehead, skailebody, skailetail;
Texture2D crystallyphases[3];
Texture2D cursors[8];
float stamina=0.0;
entity uycatroz{6,3};
entity skaile{10,3};
entity player{0,1};
Texture2D current;
void boot() final {
mappath=AT("res/map");
this->nodes={
new enginend::nodes::twod::relative::textured()
};
std::string newpath=AT((mappath+"/"+lightlevel[lightmode]+"/"+sides[player.dir]+"/"+std::to_string(player.pos)+".jpg"));
current=LOADMAP
}
void tick() final {
bool changed=false;
if (stamina>=1.){
if (ifforward()){player.pos=moveentity(player.pos,player.dir,false);changed=true;}
if (ifbackward()){player.pos=moveentity(player.pos,player.dir,true);changed=true;}
if (ifleft()){player.dir=rotateentity(player.pos,player.dir,false);changed=true;}
if (ifright()){player.dir=rotateentity(player.pos,player.dir,true);changed=true;}
if (changed) {
UnloadTexture(current);
std::string newpath=AT((mappath+"/"+lightlevel[lightmode]+"/"+sides[player.dir]+"/"+std::to_string(player.pos)+".jpg"));
current=LOADMAP
tiny::success((char*)newpath.c_str());
}
}else stamina+=.01;
}
void draw() final {
int screenw=GetScreenWidth();int screenh=GetScreenHeight();
BeginDrawing();
ClearBackground(rl::WHITE);
DrawTexturePro(current,{0,0,480,280},{0,0,(float)screenw,(float)screenh},{0,0},0,rl::WHITE);
EndDrawing();
}
};

View file

@ -5,18 +5,23 @@
// 14 15 16
// N S L R
std::vector<char>opposites{1,0,3,2};
std::vector sides{
std::vector<char> sides{
'n','s','l','r'
};
std::vector<std::string> lightlevel{
"off","on","urcooked"
};
#define N (-1)
std::vector<std::vector<char>> map{
{N,7,N,1} ,{N,8,0,2} , {N,3,1,N} ,{2,4,N,N},{3,N,5,N},{10,N,6,4},{9,N,N,5},
{0,11,N,8} ,{1,13,7,N}, {N,6,N,10},{N,5,9,6},
{7,14,N,12},{N,N,11,N}, {8,16,N,N},
{11,N,N,15},{N,N,14,16},{13,N,15,N}
// 0 1 2 3 4 5 6
{N,7,N,1} ,{N,8,0,2} , {N,3,1,N} ,{2,4,N,N},{3,N,5,N}, {9,N,6,4},{10,N,N,5},
// 7 8 9 10
{0,11,N,8} ,{1,13,7,N}, {N,5,10,N},{N,6,N,9},
// 11 12 13
{7,14,N,12},{N,N,11,N}, {8,16,N,N},
// 14 15 16
{11,N,N,15},{N,N,14,16},{13,N,15,N}
};
#undef N
@ -38,4 +43,40 @@ char rotateentity(char pos,char dir, bool clockwise) {
return look[2][dir];
}
return look[!clockwise][dir];
}
}
bool ifforward() {
if (IsKeyPressed(KEY_W))return true;
if (IsKeyPressed(KEY_UP))return true;
if (IsKeyPressed(KEY_KP_8))return true;
return false;
}
bool ifbackward() {
if (IsKeyPressed(KEY_S))return true;
if (IsKeyPressed(KEY_DOWN))return true;
if (IsKeyPressed(KEY_KP_2))return true;
return false;
}
bool ifleft() {
if (IsKeyPressed(KEY_A))return true;
if (IsKeyPressed(KEY_LEFT))return true;
if (IsKeyPressed(KEY_KP_4))return true;
return false;
}
bool ifright(){
if (IsKeyPressed(KEY_D))return true;
if (IsKeyPressed(KEY_RIGHT))return true;
if (IsKeyPressed(KEY_KP_6))return true;
return false;
}