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 / BattleShip Game

Author
Message
almas90
14
Years of Service
User Offline
Joined: 1st May 2010
Location:
Posted: 2nd May 2010 05:42
I m stuck with this game, there is nothing special about the game, simulator of well known board game, game played against another person, on the same computer... you click to past a ship in grided field. and the problem I dont know how to change an image at specified position!really need some help here.

Attachments

Login to view attachments
JTK
14
Years of Service
User Offline
Joined: 10th Feb 2010
Location:
Posted: 2nd May 2010 10:13 Edited at: 2nd May 2010 10:21
Ok, here's what I see...

First off, the following code makes no sense to me:



Are you trying to erase the image from the screen?

Second, you really don't need to dbLoadImage() every-time you call DrawField(). Call the dbLoadImage() once (before your first call to LocateShips() to save some CPU cycles - and possibly [not quite sure on this] some memory thrashing)...

And finally, to answer your question:

dbPasteImage() will paste the current image to the current bitmap; that is, whatever bitmap was set with the last call to dbSetBitmap(). So, my suggestion is to add the following lines:



before the switch() statement in the DrawField() function...

and then after the switch() statement, add the following line:



to restore the "current bitmap" to its original state.

Beyond that, I really don't see anything wrong with the code...

Hope this helps,

JTK

EDIT: Note - If you call dbCreateBitmap() at any point, the newly created bitmap becomes the return value of dbCurrentBitmap() - so, even if you haven't specifically called dbSetCurrentBitmap() you may still lose the *default* current-bitmap value of 0...

Login to post a reply

Server time is: 2024-07-07 01:40:39
Your offset time is: 2024-07-07 01:40:39