October 25, 2025, 07:21:37 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Marblez game

Started by Brian, September 15, 2024, 08:26:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brian

This game was created in IBasic a long time ago, and I used to play it. It's good

I decided to convert it to IWB, but I am struggling with some ENDIFs and ENDSELECTs, either missing or in the wrong place, and I can't get my head round it. Anyone care to help convert it, so it compiles correctly?

Brian

LarryMc

I got it in a form where it will compile and run. The only way I could do it was to indent all the lines. That's the only way I can program. I don't see how you can follow the program without indenting but there's more then one way to skin a cat. My mind just won't work that way.
Anyway, I got it going so at least you got something you can troubleshoot.
 LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Thanks, Larry. I must admit I have been struggling to get your code to show any bitmaps

Here's the original code in IBasic, plus exe, if anyone feels like playing it

Brian

LarryMc

I know what is happening but I don't know why.Lets see if I can describe what's going on. It all resolve around the GETSTARTPATH command.
I have IWBasic installed on my d-drive because of the way this new HP is set up it has limited space on c-drive. I downloaded your program and put it on D-drive and un-zipped it to its own folder.
To troubleshoot I added OPENCONSOLE AND CLOSECONSOLE commands to the program  so I could look at some of the things going on in the program. Since it were the images that weren't appearing I went there.
First I looked at:
path$=GETSTARTPATH
to make sure it wasn't blank and it wasn't.
Then I looked at:
bitmap0= LOADIMAGE(GETSTARTPATH+"blank.bmp",@IMGBITMAP)
bitmapb0=LOADIMAGE(path$+"bstone.bmp",@IMGBITMAP)
bitmapr0=LOADIMAGE(path$+"rstone.bmp",@IMGBITMAP)
bitmapy0=LOADIMAGE(path$+"ystone.bmp",@IMGBITMAP)

? bitmap0
? bitmapb0
? bitmapr0
? bitmapy0
and the result for all 4  were 0

So why wasn't it loading the images?
I went to the d-drive folder where I unzipped your zip file and they were there.
I went back and print out the getstart path
and there's the problem
even though I loaded the IWB file from the folder on the d-drive, without me telling it to, it created the exe file in a
IWBdev3\project folder on c-drive which made that the getstartpath and none of the files on the zip are located there. Also not located on C: drive is IWBDEV3.  It's installed as a stick version on D- drive.
I discovered and age calculator exe on c-drive in that same project folder. So I have to figure out what is going on there.
I would suggest the best fix for you right now would be to convert the program to a project and put the images in a resource file and read them in that way.
TLMcc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

My copy was in C:\Users\Public\Documents\IWBasic\Brian Pugh\Marblez\Marblez moved the files down to C:\Users\Public\Documents\IWBasic\Brian Pugh\Marblez and it compiles and kind of runs.  It starts up, I close the start screen and then it just disappears in a few seconds.

Before I moved it, it wanted to create a directory, which made no sense to me.

Bill
When all else fails, get a bigger hammer.

Brian

Well, I've tried all sorts today to get the bitmaps to show. I know they are loading, and the wav files, as well. But they don't show
I've ended up, as Larry suggested, putting all the bitmaps, icon and wav files into a resource folder, and making a Project, which resulted in the same outcome. The wav files are loading and working
Tightened the code up a bit, and removed the opening dialog, which was not really needed
At least now the program loads up without crashing!
I've even tried loading a bitmap separately and placing it on the screen - nothing shows
I am surely missing something . . .

Brian

Egil

Brian,
At the moment none of the EB/IWB versions I have donloaded will load source files into the editor.
But since you also posted the original IBA file, I made a copy of the original and renamed it marble.cba.
Then CB loads it whithout problems, and run it both from whithin the CB editor and as an exe made with CB.

So I think the reason for your problems is a flaw or two done during the conversion.
Studying the source does not give any immediate clues, but for those wanting to study the original code, it works perfectly in CB. And for those not having CB, there is a free version posted on this forum. Should not be difficult to find.

I had not seen this game before, but it is most certainly addictive! My great-granddaughter, age eight, have been playing for a while now, and I had to promise her a copy of the program....

Good luck!

Egil
Support Amateur Radio  -  Have a ham  for dinner!

Brian

September 17, 2024, 05:38:26 AM #7 Last Edit: September 17, 2024, 06:51:33 AM by Brian
Well, I've managed to create a running version, but the mouse clicks are not being interpreted correctly, as clicking on a stone seems to react wrongly with adjacent stones

I found another wave file for when the game is over, which is included (I missed it out, really)

Just needs the mouse position sorting out . . .

Brian

Egil: When I get this version finally sorted, the exe will be portable, as all the bitmaps, sounds and icon are embedded


Brian

OK, I think I have cracked it - seems to work for me, anyway

It is now a Project, which means the icon, bitmaps and wave files are embedded into the exe, so the program is self contained. I've also added a Ctrl+N to play a new game, rather than use the menu item

Brian