Author Topic: 10x10 Puzzle Game (Woody clone)  (Read 4409 times)

0 Members and 1 Guest are viewing this topic.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
Re: 10x10 Puzzle Game (Woody clone)
« Reply #15 on: January 04, 2021, 06:33:05 am »
@Dav
it works great :)
« Last Edit: January 04, 2021, 06:45:57 am by jack »

Offline pforpond

  • Newbie
  • Posts: 76
  • I am me
Re: 10x10 Puzzle Game (Woody clone)
« Reply #16 on: January 04, 2021, 08:00:37 am »
This is very addictive, though just like Tetris I'm awful it it! It seems very crash happy on Ubuntu but works smooth in Windows 10.
Capture.PNG
* Capture.PNG (Filesize: 117.03 KB, Dimensions: 1604x1254, Views: 217)
Loading Signature...

Offline Dav

  • Forum Resident
  • Posts: 792
Re: 10x10 Puzzle Game (Woody clone)
« Reply #17 on: January 04, 2021, 09:43:11 am »
Thanks for the report @pforpond. Not sure why it would crash...maybe it's the copyimage? I don't have a linux box anymore, so I can test that.

In the code, I'm doing like back&=_COPYIMAGE(_DISPLAY), but I never free that - I just call it over.  Could that be the reason? Do calls like that need freed first?

- Dav

FellippeHeitor

  • Guest
Re: 10x10 Puzzle Game (Woody clone)
« Reply #18 on: January 04, 2021, 09:56:28 am »
Do calls like that need freed first?

Gotta watch for those copies in memory indeed.

Offline Dav

  • Forum Resident
  • Posts: 792
Re: 10x10 Puzzle Game (Woody clone)
« Reply #19 on: January 04, 2021, 10:02:24 am »
I was assuming since i reassign the variable, that the previous would be cancelled out, but that is not so?  I wasnt sure...

So If I do ..

FOR g = 1 to 10: back& = _COPYIMAGE(_DISPLAY): NEXT

It would keep 10 back& in memory, and not 1?

- Dav

FellippeHeitor

  • Guest
Re: 10x10 Puzzle Game (Woody clone)
« Reply #20 on: January 04, 2021, 10:05:03 am »
Yeah, there are 10 copies in memory after that line - which is worse, they are now no longer accessible, since you didn't store their handles.

You can confirm new ones are being generated by adding a PRINT back& before NEXT.

Offline Dav

  • Forum Resident
  • Posts: 792
Re: 10x10 Puzzle Game (Woody clone)
« Reply #21 on: January 04, 2021, 10:06:55 am »
OK. Thanks for that info. I probably knew that at one time, but forgot.  I better fix the code again.

- Dav

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • Steve’s QB64 Archive Forum
Re: 10x10 Puzzle Game (Woody clone)
« Reply #22 on: January 04, 2021, 10:07:30 am »
I was assuming since i reassign the variable, that the previous would be cancelled out, but that is not so?  I wasnt sure...

So If I do ..

FOR g = 1 to 10: back& = _COPYIMAGE(_DISPLAY): NEXT

It would keep 10 back& in memory, and not 1?

- Dav

It would, but you’d only keep the handle to access the last one.

PRINT back& and watch how the handle increments each time.  Then add a _FREEIMAGE and see the difference.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Dav

  • Forum Resident
  • Posts: 792
Re: 10x10 Puzzle Game (Woody clone)
« Reply #23 on: January 04, 2021, 10:21:59 am »
I fixed the code just now - added _FREEIMAGE the back& and undo& memory after using those. 

Thanks ya'll....

- Dav

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
Re: 10x10 Puzzle Game (Woody clone)
« Reply #24 on: January 04, 2021, 02:30:23 pm »
Hi Dav
you need to set score to 0 just before GOTO Restart, otherwise the score just keeps accumulating

Offline Dav

  • Forum Resident
  • Posts: 792
Re: 10x10 Puzzle Game (Woody clone)
« Reply #25 on: January 04, 2021, 04:03:14 pm »
Thanks, @jack!  I fixed it.  I took the fix opportunity to update scoring to more like the real puzzle game.  Now points are given for each piece put on the board, according to its size.  Also, a High Score is now kept and shown in TITLE bar (all forgotten when the program ends however, no external files created still).

New version 1.3 in first post.

- Dav

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
Re: 10x10 Puzzle Game (Woody clone)
« Reply #26 on: January 04, 2021, 04:10:31 pm »
I was sad to not get 1000...
ss.png
* ss.png (Filesize: 52.75 KB, Dimensions: 800x627, Views: 182)
« Last Edit: January 04, 2021, 05:46:14 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline Dav

  • Forum Resident
  • Posts: 792
Re: 10x10 Puzzle Game (Woody clone)
« Reply #27 on: January 04, 2021, 04:22:53 pm »
Wow, you did pretty good tho!   Ain't easy getting up that high.  Looks like you're running the earlier version, I've fixed a couple of things since then.  Just posted v1.3.

- Dav

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
Re: 10x10 Puzzle Game (Woody clone)
« Reply #28 on: January 04, 2021, 05:46:00 pm »
Oops, updated my local copy:

 
ss.png
You're not done when it works, you're done when it's right.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
Re: 10x10 Puzzle Game (Woody clone)
« Reply #29 on: January 05, 2021, 06:18:49 am »
thanks Dave
my new hi score 3333