I am new to iphone SDK. What I am doing is very simple. I have a simple 2d Maze game - think puzzle game that I am working on. I am not needing to use OpenGL for this. I am wanting to use UIIMAGE's. Imagine I have a wall tile (64x64 pixels) and I want to write code to duplicated this wall tile along the top and edges of the screen area- to in effect build a wall around the edges of the screen. play will take place inside this area. How would I go about doing this in code. From what I gather I would need to create a new UIIMAGE each time I wanted to place a tile and move coordinates. Later on though, say I wanted to take the second tile along and replace it with say a bomb. Or maybe the 4th one along? My question really is.. in code how would I address this 2nd or 4th tile (when the number 2 or 4 could be random) and change its graphic? I hope I have explained this enough.. Also If I have updated some tiles, is there a call I should be making to hurry up the screen refresh so to speak? Thanks.
A:
As I understand, you can just create some UIImageView objects. Each one for one of your tiles. And then you'll be able to change frames with animation. For example. You have image you want to replace. I have no mac right now nearby, so, my code may not wark after just copy and paste)
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5f];
[imageView setFrame:newFrame];
[UIView commitAnimations];
This code will move your image with animation.
Morion
2009-10-23 17:38:00