[Solved] lesson 12 bug ?

The Partridge Family were neither partridges nor a family. Discuss.
Raimond
Posts: 16
Joined: January 30th, 2014, 1:54 pm

[Solved] lesson 12 bug ?

Post by Raimond » February 6th, 2014, 5:39 pm

I've got a huge bug in trying to make an TicTacToe game, from lesson 12.. but i got stuck, everything worked right until the DrawCursor function... i've got the grid, i've got the cursor showing but i can't move it from the middle, it just moves a pixel in right left down and up, but doesn't move from the middle of the grid...

Here's the download for the code :
TicTacToe.rar
(33.65 KiB) Downloaded 142 times
Last edited by Raimond on February 6th, 2014, 6:06 pm, edited 1 time in total.

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: lesson 12 bug ?

Post by Pindrought » February 6th, 2014, 5:54 pm

PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

Raimond
Posts: 16
Joined: January 30th, 2014, 1:54 pm

Re: lesson 12 bug ?

Post by Raimond » February 6th, 2014, 6:06 pm

Pindrought wrote:http://www.planetchili.net/forum/viewtopic.php?f=3&t=2

Read second post in link please.

done

paapcity
Posts: 5
Joined: July 26th, 2013, 1:13 pm
Location: Netherlands

Re: lesson 12 bug ?

Post by paapcity » February 6th, 2014, 6:08 pm

i dont have checked the whole code you pasted, but in the beginning i see a space between index and ++?
it should be index++ instead of index ++
It also couls be something else, but then i have to dig further in your code, wich i only could do after my skiing :)

Raimond
Posts: 16
Joined: January 30th, 2014, 1:54 pm

Re: lesson 12 bug ?

Post by Raimond » February 6th, 2014, 6:17 pm

paapcity wrote:i dont have checked the whole code you pasted, but in the beginning i see a space between index and ++?
it should be index++ instead of index ++
It also couls be something else, but then i have to dig further in your code, wich i only could do after my skiing :)

the space makes no difference in my case

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: lesson 12 bug ?

Post by LuisR14 » February 6th, 2014, 6:24 pm

it should be

Code: Select all

DrawCursor( baseX + cursorX * squareSize, baseY + cursorY * squareSize );
:)

edit: dam computer wasn't letting me post this b4 the edits to include the project had happened
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: lesson 12 bug ?

Post by Pindrought » February 6th, 2014, 6:25 pm

Edit: Seriously Luis I was so close, can't believe you beat me by 1 minute! XD

Here's the issue.
Look at your function: Game::ComposeFrame()

Code: Select all

DrawCursor( baseX + cursorX + squareSize, baseY + cursorY + squareSize );
This is VERY close to correct. However it isn't. :'(

The issue here, is you are doing cursorX+squareSize and cursorY+squareSize

You should be multiplying those two.

So, change that line to

Code: Select all

DrawCursor( baseX + cursorX * squareSize, baseY + cursorY * squareSize );
And Tah'Dah! That shit is like magic.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: lesson 12 bug ?

Post by LuisR14 » February 6th, 2014, 6:27 pm

haha, such sync problems with each other xD, but my edit above says it xD
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

User avatar
LuisR14
Posts: 1248
Joined: May 23rd, 2013, 3:52 pm
Location: USA
Contact:

Re: lesson 12 bug ?

Post by LuisR14 » February 6th, 2014, 6:29 pm

and actually i beat you by b4 you made your 1st post in this thread xD
always available, always on, about ~10 years c/c++, java[script], win32/directx api, [x]html/css/php/some asp/sql experience. (all self taught)
Knows English, Spanish and Japanese.
[url=irc://irc.freenode.net/#pchili]irc://irc.freenode.net/#pchili[/url] [url=irc://luisr14.no-ip.org/#pchili]alt[/url] -- join up if ever want real-time help or to just chat :mrgreen: --

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: lesson 12 bug ?

Post by Pindrought » February 6th, 2014, 6:33 pm

LuisR14 wrote:and actually i beat you by b4 you made your 1st post in this thread xD
No fair :( I hadn't read it yet

Nah, haha good job finding that, I probably wouldn't have seen that if I couldn't have compiled it.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

Post Reply