Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Thu May 23, 2013 4:14 pm

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Jul 13, 2012 3:05 pm 
Miko-Class Veteran
User avatar

Joined: Mon Dec 13, 2010 9:30 am
Posts: 842
Location: New Brunswick, Canada
Projects: Camp Renard
This is a demo that uses Ren'py Cardgame to make a jigsaw puzzle. (http://www.renpy.org/wiki/renpy/Cardgame)

Screen Shots:

This is what the puzzle looks like when you are playing it:
Image

You can drag pieces to have them switch places:
Image

Or click on pieces to have them rotate.
Image

Theory

In Cardgame, you have stacks and cards. Cards are the things you can move around. Stacks are places where you can put cards.

Basically, I made a grid of 12 stacks (4x3) that each contain one card.

Practical

You get your image and slice it into squares. It is important that the pieces are square because you are going to be rotating them.

I used and 800x600 image and cut the pieces into 200x200 px squares using a combination of Gimp, Gimp plugin New Guides Every X Pixels: http://registry.gimp.org/node/13774, and Image>Transform>Guillotine (http://gimp4you.wordpress.com/2008/05/1 ... ce-images/)

The files are named "room-i-j.jpg" where i and j refer to the column and row of the image. (Yeah -- I just realized I got it backwards)

If you want to have a different number of pieces, you just need to play with this section of code:

Code:
        def __init__(self):

            # Constants that let us easily change where the game is
            # located.
            LEFT=100 #half of the size of the piece
            TOP=100
            COL_SPACING = 200 #the size of the piece
            ROW_SPACING = 200
            self.COL_NUM = 4
            self.ROW_NUM = 3


Possible Improvements
- make the code more generic so you can have different puzzles in the same game
- add sound effects

This code is delivered as is. I will answer questions about it, but I will not write your game for you. :)

Susan


Attachments:
Puzzle Demo-all.zip [17.92 MiB]
Downloaded 703 times

_________________
In order to understand recursion, one must first understand recursion. (Anonymous)
Top
 Profile Send private message  
 
PostPosted: Fri Jul 13, 2012 7:43 pm 
Eileen-Class Veteran
User avatar

Joined: Fri Jun 05, 2009 3:31 am
Posts: 1596
Location: Illinois, USA
Projects: Twelve
Organization: Kitsch-soft
Aw, this is neat! Thank you Susan! :)

_________________
“When I stand before God at the end of my life,
Aspiring writer-artist.

I would hope that I would not have a single bit of talent left,
and could say, 'I used everything you gave me.'”
— Erma Bombeck

▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬
Works in Progress
Twelve - love story of an A.I. and her programmer
PAW ★ PRINTS - Laika in the Space with Tetris


Top
 Profile Send private message  
 
PostPosted: Thu Apr 25, 2013 4:18 pm 
Miko-Class Veteran
User avatar

Joined: Mon Dec 13, 2010 9:30 am
Posts: 842
Location: New Brunswick, Canada
Projects: Camp Renard
Once again I am leveraging the excellent code of KimiYoriBaka's Drag and Drop Jigsaw Tutorial (viewtopic.php?f=8&t=12504) and created my own version.

Attachment:
screenshot0001.png
screenshot0001.png [ 250.12 KiB | Viewed 196 times ]


It creates the puzzle pieces using Crop and AlphaMask (http://renpy.org/wiki/renpy/doc/referen ... .AlphaMask) I created 24 (6x4) puzzle pieces and use them as a template.

One thing I did differently is that the puzzle is one long interaction, which means you can't save midway through the puzzle. I haven't decided if I want it to be able to save.

Sorry about the annoying noise. :)

Susan


Attachments:
File comment: Unzip in your Ren'py Files directory
jigsaw2.zip [481.48 KiB]
Downloaded 13 times

_________________
In order to understand recursion, one must first understand recursion. (Anonymous)
Top
 Profile Send private message  
 
PostPosted: Thu Apr 25, 2013 10:43 pm 
Miko-Class Veteran
User avatar

Joined: Sat Jan 01, 2011 1:22 pm
Posts: 859
Location: Philippines
Completed: Caught in Between: A childhood prologue
Projects: I'm drowning myself in a lot of them! Most of them are collabs only though!
Oh, wow... This is awesome! I've been trying to implement something like this in one of my VNs for a long time now, but I've given up. And now that I've seen something like this, I can try again. Thanks for this! ^__^

_________________
Image Image
"A fool who doesn't think is more foolish than a fool who foolishly thinks." - Franziska Von Karma
My avatar is chibi Alex in disguise, not chibi Zander. >_>


Top
 Profile Send private message  
 
PostPosted: Fri May 03, 2013 8:10 pm 
Regular
User avatar

Joined: Mon Dec 24, 2012 9:37 pm
Posts: 68
Location: Costa Rica. Sorry if I don't pretend to be Japanese.
This is very cool! Thanks! :shock:

Hope SusanTheCat doesn’t mind, but I created anti-aliased versions of the jigsaw pieces.
I also did a bevel effect layer to put over the jigsaw image so the pieces appear to have volume.
Of course, you’d better use a clean version for the win image. :D


Attachments:
File comment: Just replace the original "puzzle_pieces" folder with the one in this zip.
For the puzzle pattern, I think its decent enough to just place over your image, but you may want to try blending options to get different results.

pieces.zip [605.72 KiB]
Downloaded 7 times
jig.jpg
jig.jpg [ 141.67 KiB | Viewed 111 times ]

_________________
Image Image Image Image
FREE and easy 3D figure customization, posing, and animation software using virtual people and environments:
DAZ Studio Pro 4.5
Top
 Profile Send private message  
 
PostPosted: Sun May 05, 2013 8:40 pm 
Miko-Class Veteran
User avatar

Joined: Mon Dec 13, 2010 9:30 am
Posts: 842
Location: New Brunswick, Canada
Projects: Camp Renard
Hellboy wrote:
This is very cool! Thanks! :shock:

Hope SusanTheCat doesn’t mind, but I created anti-aliased versions of the jigsaw pieces.
I also did a bevel effect layer to put over the jigsaw image so the pieces appear to have volume.
Of course, you’d better use a clean version for the win image. :D


Those look freakin' awesome! Thank you.

*\o/*

Susan

_________________
In order to understand recursion, one must first understand recursion. (Anonymous)


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group