Discussion on OpenGLES/OpenAL Sliding Puzzle Game Starter Kit

12 comments found.

Hi, i was just wondering if this is already coded for iPad

Thanks,

Hi Duncan this project targets iPhone and iPod touch. It will upscale on the iPad but has not been specifically targeted for iPad.

Hi, great job, is this app already prepared to have multilevels, or different images?

Thanks

thank you for this cod very cool but just i need to ask you how i can change the number to later or image for puzzel

Hi Edse and Ola

The game uses a 512×512 image as an OpenGL texture which is then sliced up automatically. You can replace the image with another PNG . I would recommend 32bit color. Regarding multilevels the project as supplied does not have any mechanism for multiple levels however it is fairly trivial to add. You just need to add the concept of the current level number for example which you could set to a random value when the board is reset e.g. 1 to 3 (if you have 3 images) then modify the code to use the appropriate image file for the “level” you are playing.

e.g.

int currentlevel = arc4random() % 3;

Cheers

sorry i try to change the image but cant. i try all the png file inside the sours but not working can plz explain more from where i can change the image to

thank you

Please make sure the image is 512×512px and saved in 32bit color. You should be able to achieve this using Photoshop, Paint.NET or GIMP etc:

The file you are replacing is image1.png

Thanks

thank you its work very nice

Hey can you add timer in this? I am thinking to buy but just need timer on this….

Hi Manepali,

Please can you clarify your request for customisation?

Could you describe how you would envisage the timer working? i.e. counting how many seconds the user has been playing the level or a countdown to complete the level in a target time? Would you expect any other related functionality?

Thanks

What I want is the alert that will popup when user finish the game….for example the alert should say “it took 5min to complete this puzzle ”.

This should be quite trivial:

What you need to do add code similar to below (note i’m just typing this off the top of my head):

// 1. add code to store date when level is started

NSDate *startDate = [NSDate date];

// 2. add code work out how much time elapsed and show an alert

int seconds = (int) [startDate timeIntervalSinceNow]; NSString *msg = [NSString stringWithFormat:"It took %d seconds to complete this puzzle",seconds]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release];

That should do it :)

Hi unitedcommand, I would like ask, before I buy this code, available more images in this app, if the first image is ready? If yes, this is setupable in the code? Thank you the reply. Best regards.

Hi potyek

Yes you can easily customise the code to load many different PNG images.

Cheers,

This looks perfect for a project I am just starting. However, how easy would it be to add the function to use an image from the handsets library? Would you be prepared to write this as a commisioned update? Many thanks.

Hi, it’s possible to achieve this if you want, but may not be trivial. You would use a UIImagePickerController with UIImagePickerControllerSourceTypePhotoLibrary to source the image. However the image would then probably need to be resized to 512×512 to be loaded as an OpenGL texture without any scaling issues and you’d need to do that in code as well.

Hello,

What line of code do you actually use to specify the coordinates on the image1 to draw the tile? I’m trying to figure out how you calculate the texture coordinate of the image to draw the number tile.

drawView GLfloat tcs[] = { (float)tx/320.0f, (float)ty/400.0f, (float)tx2/320.0f, (float)ty/400.0f, (float)tx/320.0f, (float)ty2/400.0f, (float)tx2/320.0f, (float)ty2/400.0f };

Please see my reply to your earlier msg thanks.

Thank you.

Hello,

When grabbing the image, you specify the number 80 to divide by to get the tile location. Where did you come up with that number as the tiles are 128×128?

nick5454 has purchased the item.

It is a virtual/notional 320×400 area split into 80×80px to give 4 columns and 5 rows. When converted back to actual texture coords they end up fractional values between 0 and 1 on the 512×512px loaded texture:

GLfloat tcs[] = { (float)tx/320.0f, (float)ty/400.0f, (float)tx2/320.0f, (float)ty/400.0f, (float)tx/320.0f, (float)ty2/400.0f, (float)tx2/320.0f, (float)ty2/400.0f };

Hope that makes sense. Cheers.

by
by
by
by
by
by