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 / 2d simple map editor problem

Author
Message
Zapleaf
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 11th Nov 2011 01:54 Edited at: 11th Nov 2011 01:56
I have been tinkering with this application I am working on for about 2 hours now and I have got to admit my head is about to explode. I can not pin point where my problem is, but I am almost certain my array or loops have something to do with it.

My map editor does a simple task, it waits for a mouse click and then plots a Tile according to your mouse position on a grid by 32x32 tile sets. Everything runs well and good till i get down to the bottom of the map and it starts to do some crazy things. It seems to wrap the value around and plot the tile at the top of the map instead.

I have NO idea where this problem starts, so here is my entire application if anyone is willing to give it a quick glance.

101 Lines, Hope you take the time to find my problem!

There are no special libraries other than dark GDK. I run it in VC++ 2008. If you want to copy past to see what I mean it may help you to help me!

Thanks in advanced for trying to help.
afaik
13
Years of Service
User Offline
Joined: 12th Jun 2010
Location: NYC
Posted: 11th Nov 2011 04:22 Edited at: 11th Nov 2011 04:48
Hmm, 408/32 = 12.75. I'm not an expert, but this is what I found to be so far working for me with your code:


If you replace 408 with 384, and get rid of the equal signs with your relationship operator, it seems to work better. Also, your functions didn't return anything so I made them void. Someone triple check my analysis please, I'm just a noob.
Zapleaf
14
Years of Service
User Offline
Joined: 16th Oct 2009
Location:
Posted: 11th Nov 2011 14:20
That actually works! I adjusted it to 416 (divisable by 32) and changed the array size from 12 to 13 and everything works. I am very curious why I was having such strange results though.

Thank you!

Login to post a reply

Server time is: 2024-05-02 02:31:34
Your offset time is: 2024-05-02 02:31:34