From d97333c39adf36d4782b9a539b7463ecb543467f Mon Sep 17 00:00:00 2001 From: zombie Date: Sat, 12 Feb 2022 05:48:58 -0500 Subject: [PATCH] gaming is now game --- a.out | Bin 17888 -> 19904 bytes playergame.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 playergame.c diff --git a/a.out b/a.out index df3696ca082b5b6ac45894067c6fd9036a90a004..8ba520f07f90c7488c49666cbc99422a587debff 100755 GIT binary patch literal 19904 zcmeHPdvx2?eZN1+KU;puc5Ek3La_3p;bGYhNoEr}mJ=(H8|OjZFyI$il4UivM=;|1X@!9xR6BqeDA}N z6pL;>JNu`)KEL~YfA78D`+MB``|0buogEuZn#NQyvvrK9@lwHYNWoZ}L;xJDffb`( z#+I^N&^eqZLEe0%UJTIL_s+YveQW<>2&xu z7c!=xlFzhfBV!aBuV>&8DWE8rY)7#N)M?&_MybIK? zIvjM`Y}&e;nTFUH@sz#Bv=rJTX{hi*x)nGm>}3Cq=c9#Z+gF|Vc)H?^!=E$RGv-uy%z#q-P_hjIIHv@kW_%1Mv5w?7bM{eE8*RDW;ippOMZK2LXu1%iQS#1m$b zsFy%rEE-{+o{;AN>k9{h(JnOY8E_k2fuOr5@CE7#t`m>!Nv|7TK?gmtaKsnsr>kWR zF+2j>)X~0vgR#=S(!QE)-LQMdPUp_OYmC+Qdi%;cls~9zQ0z6vuJ)}Pw?S5CuWxK@ ztgl;nGsVY*>xHhE9R6qKR|3(*B??y={$2owt{WSU*n$9_1Uc-dz^Q1^`A0yKQ*nL0 z2A7SQjRPm1dCOkZCiW3(D(b$i=H)b9Y$)UMzO48|l0V?!;+gxaqR+GlK3${9*Y9`| zUp=x&b0UdfAWV5ZmBcSf;!h{>)!0a^&MUf4$u4rMDhCHF4?q(ruWb%N5Z@$FUaxQn zg7_41Rq7l9Bffluaz;ZEpT?|;!yz!zr$ZH&Ltw;HF(uA+2h~EiP@uft=MV(x7Ymfv z`yGNHzEz;S?sf=*_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!vnB;-LH5ygoRcL+z5~+veCq2cqJXKu!~QD6e9=n(K{7x+)6Dwo)JIdm=*n+_U|Zm z{F(c)p(%EfmXzD{;tqRanjwS_1~^2RB|VRd$aIn&E|zj08>JI) zD;qs*Xjas1wFz(uZh|qv;yBCud8o|8G!{!Et*W$dItWrT%0oWSqJ;I<18x;eXj1X4 zN(0OaA7$-|Hx%2)J)dV0Va08UOVG2xx%7BcdzrGAmxWD6l6mElKz{+8&8Jm~8c@t` z0X4&S*ym9Ig`89L)&Cy+#sk?u00;e&|C!cZ#Xvn^YFe9N6LPQ%gAMob#W2$0op!v2 z`ght%Dd@=m5We2^p}4pM$2>>qK-Ctjylp+T4RzJKTQ<8kySCE8>MmzXOItMB5{>!c z9|b=>?61Ukv@TZ{o7s_C3XYZSzJ@P(C5-c_v&L;zZ%>uZBHC8tvZ$A=O5dSQZvjo# zm@Vp!r_vmHr^anj?@5(8CQ0XN|V%I>$a*luS#3t!md35f1jK__riZZb^QYx z+U9eM%GaB;(YJgx_!rdgEf}dYi|TGaOC5Ek;)EoB#EG$I>uNDBqoaG>qPmsJ=->91 zTGa30+bFB*`Mf;!d4wbI56(vW>eu4^^v(KR;%kc5F*;gPFw&4GYB$Sf*JU$6ZYanN zj+_MK-6v(8aq6#!B?IJn_Dq8EHoenOD(bh&oJ5_CrQ+IhnfoCfZLrg$jgok*LPk1S G(EkFhNK88b diff --git a/playergame.c b/playergame.c new file mode 100644 index 0000000..33c5857 --- /dev/null +++ b/playergame.c @@ -0,0 +1,96 @@ +#include //printf and shit +#include +#include + + +int main( int argc, char *argv[] ) { //yoinked from the internet argc is number of args and argv is a "array of arguments" + clock_t prevtime, currenttime; + prevtime = clock(); + int delay = 1000; + int dosspin = 0; + + + bool gamerun = true; + + struct entity { + int x; + int y; + } + player = {0, 0}, + enemy = {24, 16}; + + initscr(); + //cbreak(); + nodelay(stdscr, true); //cbreak would wait for you to press a key this doesnt + noecho(); + + clear(); + + while(gamerun) { + currenttime = clock(); + dosspin = clock() % 4; + if ((currenttime - prevtime) > delay) { + mvaddch(player.x, player.y, ' '); + + switch (getch()) { + case 'a' : + player.y--; + break; + + case 'w' : + player.x--; + break; + + case 'd' : + player.y++; + break; + + case 's' : + player.x++; + break; + + case 'q' : + gamerun = false; + break; + } + switch (dosspin) { + case 0 : + mvaddch(enemy.x, enemy.y, '-'); + break; + case 1 : + mvaddch(enemy.x, enemy.y, '/'); + break; + case 2 : + mvaddch(enemy.x, enemy.y, '|'); + break; + case 3 : + mvaddch(enemy.x, enemy.y, '\\'); + break; + } + //game logic not kb dependent + if ((enemy.x == player.x) && (enemy.y == player.y)){ + endwin(); + puts("you lose :("); + return 0; //TODO fix this this should not be here... + } + if ((clock() % 500) == 1) { + if (enemy.x > player.x) { + enemy.x--; + } else {enemy.x++;} + if (enemy.y > player.y) { + enemy.y--; + } else {enemy.y++;} + } + prevtime = currenttime; + } + mvaddch(player.x+1, player.y, '#'); //idk how to fix + } + + //cleanup + endwin(); + + printf("Args %d",argc); + + puts(argv[0]); + return 0; +}