Skip to content

jtg2078/Puzzle

Repository files navigation

Puzzle

Setup

Clone from github

  • git clone git:https://github.com/jtg2078/Puzzle.git
  • cd puzzle
  • git submodule update --init

About this project

Introduction

Lets build a slider puzzle~

Description

This project is about building a slider puzzle app that allows users to move tiles(or blocks) by either tapping them, or sliding them with touches. For the sliding part, the users can slide row or column of tiles if applicable.

Implementation detail

Animating the tiles

To animate the movement of blocks, I've decided to use [UIView animateWithDuration…] and utilize the duration parameter to control the pace of the animation. The end result is somewhat satisfactory, but it could definitely be better. One other way I can think that could probably give a smoother movement is using [CADisplayLink displayLinkWithTarget…] to control the position of blocks. Will definitely try it on the next update…

Moving the tiles

User interactions, primarily the touches, are being handled by UIGestureRecognizer. Two types of gesture recognizer are used in the project, UITapGestureRecognizer and UIPanGestureRecognizer. I choose to use gesture recognizers instead of [UIView touchesBegan…] and related methods are mainly because they are easier to implement and go rather well with [UIView animateWithDuration…]. Again, if we are going to use the [CADisplayLink displayLinkWithTarget…], then it is probably better to switch to [UIView touchesBegan…] to handle user touches there.

Miscellaneous

Testlfight is used(added as submodule)

Moving on

  • add a solver to solve the puzzle step by step
  • ability to change the image from a set of images or use the camera to take a picture instead
  • optimize the code for handling touches and blocks movement mechanism
  • add a timer
  • layout and icons

About

a sliding puzzle 0.o

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published