Hack Forums
[C] Maze Project in C - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C] Maze Project in C (/showthread.php?tid=5926345)



Maze Project in C - Avlis - Jan 5, 2019

Hi guys i have a school project to do in Code blocks, more precisely in C Language! Have u some base structure, that u can give me!
requirement: moving the object whit the keys : WASD;
when the object goes against a wall, the player lose;


Thank you


RE: Maze Project in C - SIM-574702 - Jan 5, 2019

Considering you said school I'm assuming you know if branching, loops and functions.

You will need:
- generating function that will create random maze or hardcode one yourself. I'm not sure how complex creating maze is so if you're allowed to just use bunch of '|' and '-' to create basic structure.
-drawing function that will show current position
-movement and collision logic functions
-infinite loop that reads key input and calls other functions.


RE: Maze Project in C - Avlis - Jan 5, 2019

i'm asking for help because i didn't learn anything in school, so, yeah i know what you are talking about, but i dont no how to do it


U have discord or something like that ?


RE: Maze Project in C - Mayuko - Jan 5, 2019

To read keys take a look at this:
man getch
For the drawing function:
Make an array or something like that, fill it with you maze + the pointer to show the player position (use write() or printf() or whatever to print)
For the collision:
Really ? It's just a condition

PM if you need some help.


RE: Maze Project in C - El Lobo - Jan 5, 2019

How about using opengl for creating a maze game? I smiply see no benefit in trying to use bunch of if statements and loops for it. And I mean benefits in you actually learning all of that shit instead of spagetti code.


RE: Maze Project in C - Avlis - Jan 10, 2019

Thank you for all! Is already done