diff --git a/games/animatronical/q1/a1/src/scenes/game.h b/games/animatronical/q1/a1/src/scenes/game.h index 8df8177..a562814 100644 --- a/games/animatronical/q1/a1/src/scenes/game.h +++ b/games/animatronical/q1/a1/src/scenes/game.h @@ -20,6 +20,7 @@ extern std::vector 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(); +bool cansee(char dest,char pos, char dir); extern std::vector sides; extern std::vector lightlevel; @@ -35,6 +36,8 @@ struct game:public enginend::scene { entity skaile{10,3}; entity player{0,1}; Texture2D current; + bool canseeuycatroz=false; + bool canseeskaile=false; void boot() final { mappath=AT("res/map"); this->nodes={ @@ -46,6 +49,7 @@ struct game:public enginend::scene { } void tick() final { bool changed=false; + bool updateview=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;} @@ -55,17 +59,28 @@ struct game:public enginend::scene { 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()); + //tiny::success((char*)newpath.c_str()); + updateview=true; + } + if (updateview) { + canseeuycatroz=cansee(uycatroz.pos,player.pos,player.dir); + canseeskaile=cansee(skaile.pos,player.pos,player.dir); } }else stamina+=.01; } void draw() final { - int screenw=GetScreenWidth();int screenh=GetScreenHeight(); + float screenw=(float)GetScreenWidth();float screenh=(float)GetScreenHeight(); BeginDrawing(); ClearBackground(rl::WHITE); - DrawTexturePro(current,{0,0,480,280},{0,0,(float)screenw,(float)screenh},{0,0},0,rl::WHITE); + DrawTexturePro(current,{0,0,480,280},{0,0,screenw,screenh},{0,0},0,rl::WHITE); + if (canseeuycatroz)DrawRectangle( + screenw/10.,screenh/10.,screenw/12,screenh/1.5,rl::BLUE); + if (canseeskaile)DrawRectangle( + screenw/2.,screenh/10.,screenw/12,screenh/1.5,rl::RED); + DrawText(("pos: "+std::to_string(player.pos)+" dir:"+std::to_string(player.dir)).c_str(),0,0,64,rl::WHITE); EndDrawing(); + } }; \ No newline at end of file diff --git a/games/animatronical/q1/a1/src/scenes/scenes.cpp b/games/animatronical/q1/a1/src/scenes/scenes.cpp index 6bd4ca6..0d8a3a2 100644 --- a/games/animatronical/q1/a1/src/scenes/scenes.cpp +++ b/games/animatronical/q1/a1/src/scenes/scenes.cpp @@ -24,6 +24,35 @@ std::vector> map{ {11,N,N,15},{N,N,14,16},{13,N,15,N} }; #undef N +std::vector>> visibilitychart{ + + {{},{7,8,11,14},{},{1,2,8}},//0 + {{},{7,8,11},{0,7},{2}}, + {{},{3,4},{0,7},{}},//2 + {{2},{4,5},{5,6,9,10},{}}, + {{2,3},{},{5,6,10},{}},//4 + {{3,9,10},{},{6},{4}}, + {{9,10},{},{},{5,4,3}},//6 + {{0,1},{11,14},{},{1,2,8}}, + {{0,1},{13},{7,1},{}},//8 + {{},{6,10},{3,4,5,6},{}}, + {{},{5,6},{},{3,5,9}},//10 + {{0,7},{14},{},{12}}, + {{},{},{11},{}},//12 + {{0,1,8},{},{16},{}}, + {{0,7,11},{},{},{15,16}},//14 + {{},{},{14},{16}}, + {{13},{},{14,15},{}}//16 + +}; + +bool cansee(char dest,char pos, char dir) { + std::vector check=visibilitychart[pos][dir]; + for (char i: check) { + if (dest==i)return true; + } + return false; +} char moveentity(char pos,char dir,bool backwards) { diff --git a/games/pretend/CMakeLists.txt b/games/pretend/CMakeLists.txt index 4bea9e2..89be7f2 100644 --- a/games/pretend/CMakeLists.txt +++ b/games/pretend/CMakeLists.txt @@ -18,6 +18,7 @@ set_target_properties(pretend PROPERTIES target_link_directories( pretend PUBLIC "${CMAKE_SOURCE_DIR}/link") + target_link_libraries(pretend PRIVATE enginend raylib diff --git a/games/pretend/src/main.cpp b/games/pretend/src/main.cpp index 2dc53d2..e69de29 100644 --- a/games/pretend/src/main.cpp +++ b/games/pretend/src/main.cpp @@ -1,3 +0,0 @@ -// -// Created by komi on 2/23/26. -// \ No newline at end of file