Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Games And Graphics In C++

Author
Message
Brick Wall Infinite Loop
13
Years of Service
User Offline
Joined: 21st Mar 2011
Location:
Posted: 21st Mar 2011 07:26
Hello World!
This is my first posting here, and it is also my first time using any sort of code, so be gentle with the criticism please. As you can tell from the title, I am using the book "Game & Graphics in C++," in conjunction with the DarkGDK library, and I need help with the majority with the projects inside. If any of you are willing to take the time to help me out, I deeply appreciate it. As of right now I am using infinite loops to create a seamless brick wall, and unless I draw each box individually I will be at a loss here. This is for a class, so quick responses are appreciated.

Thanks,

Blue_Fox_893

Use the right word, not its second cousin.
- Mark Twain
Para _Charlie
18
Years of Service
User Offline
Joined: 31st May 2006
Location: Wisconsin
Posted: 21st Mar 2011 14:54
If it is for a class maybe you should ask your teacher to help you with something you dont understand?

Like 30 different TGC products. Cause I get bored easy.
Asus P5Q MB, P3.0 dual core, 4gigs ram, SATA HD, GTX 260
Win 7.
Pilz X Schizo
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Massachusetts, USA
Posted: 21st Mar 2011 16:54
I would agree that if this is for a class that the teacher should be able to help you with anything you don't understand.

Really all you need to do is use 2 for loops (one nested inside the other) to draw your grid of bricks. I would give you more, but since it is for a class I don't feel it would be right to just hand you the code for this. Classes are about learning, so if you look into for loops and tile based maps you should find your answer or at least the means to figure it out.

Brick Wall Infinite Loop
13
Years of Service
User Offline
Joined: 21st Mar 2011
Location:
Posted: 21st Mar 2011 18:06
I have not intention of cheating, my academic career can't afford me to. I am merely asking for some clarification on the usage of loops to avoid drawing each individual box. In regards to my teacher, he is geared more towards a "students teaching themselves" mentality, but I digress. The text we are using for this class provides far to few examples on how to execute the various types of loops, and then we are expected to go one step beyond. For instance, the lesson provide for the bricks homework merely tells me how to draw random bricks, but the lesson does provide examples on how to create a seamless line of bricks.

Use the right word, not its second cousin.
- Mark Twain
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 21st Mar 2011 19:12
First off, infinite loops are a bad idea especially for a beginner. The novice tends to forget to put in some kind of breakout and will result in locking up the program. The aforementioned "nested loop" is the best method. For an infinite wall, simply move the ones off screen to the other end of the wall.

You should also include some code with a specific problem and people on this forum are more than happy to help.

The fastest code is the code never written.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 24th Mar 2011 08:29 Edited at: 24th Mar 2011 08:46
This brick wall question has been asked before. Maybe something in this thread will help you.

http://forum.thegamecreators.com/?m=forum_view&t=176721&b=22

If you already have an example for a seamless line of bricks, then it must show you a loop where the horizontal coordinate is determined by the loop variable. You only need to expand that into two loops (nested loops), where the other loop variable determines the vertical coordinate. (EDIT: In fact, it would be easier and faster to show you the code itself than try to explain in many words how you write a nested loop.)
DeadTomGC
14
Years of Service
User Offline
Joined: 11th Aug 2010
Location: LU
Posted: 25th Mar 2011 15:53

Login to post a reply

Server time is: 2024-10-02 15:30:01
Your offset time is: 2024-10-02 15:30:01