Monday, March 25, 2013

Winner screen

  In my tic tac toe game I had a  little pop up text messages (toasts) that declared the winner. Today I added images "You win" and "I win" to display when someone wins.
   The steps for doing this is,
put the desired images in res folders.
Create a layout xml file.
Create class for the activity which includes the new layout
public class IWinActivity extends Activity

 Add the activity to the manifest.

       <activity android:name=".IWinActivity" >
        </activity>


 Then add the statements to start that activity when needed.

Intent iWinIntent = new Intent();
iWinIntent.setClass(MainActivity.this, IWinActivity.class);
startActivity(iWinIntent);


  One problem I need to figure out is how to have the win image display for a few seconds then go back to main activity. I tried Thread.sleep(5000) but all that does is pause the switch of layouts from Main to win layout for 5 secs then is flashes the win image and returns back to Main activity. I think what I need to do is create a separate thread for timing. When the time is finished it notifies win activity which then can switch to main activity.

Wednesday, March 20, 2013

Graphic Layout Buttons

    I ran in to a weird problem with Eclipse while adjusting button layout for the game Tic Tac Toe. In the graphical layout the buttons went from top to bottom , left to right 1,2,3,4....9 but when I ran it on the emulator and on an actual phone the buttons looked correct but were mixed up. For example button 1 was in button 8 position. You can imagine how that screwed up the game. I was trying to center the buttons with RelativeLayout. I ended up "fixing " the problem by wrapping RelativeLayout in a LinearLayout and centering it.
  To make it look better I removed the outline of the buttons so only the images showed by adding this line to each of the buttons.
android:background="@null" 
I also removed the reset button.
There maybe a better way but it worked.

Things I still need to do
1: Bigger buttons.
2: Improve the look of the buttons.
3: Show all moves ( does not show the last move , it goes straight to declaring winner then resets).
4: Show win or lose image for a limited time then reset game.
5: Test on different devices.

I am not sure if I should bother uploading to Google play. I have no illusions of making any money with this but I was thinking it might be good for the experience.

Friday, March 15, 2013

Tic Tac Toe update

 
 I decided to give my game a different look after my 2 year old niece tested it. I changed the images to make it more appealing to little children. The trouble I am having now is getting the layout to look correct. As you can see by the image  , the reset image is to big for the button and I would like the buttons to take up the whole screen. Lastly I want to add win/lose pictures. After all this then I have to make it look good on various screens. I have been debating whether or not there should even be a reset button.

10,000 hour to Mastery.
10,000 - 391 = 9609 hours left  

Friday, March 1, 2013

Tic Tac Toe progress


I've finished "Android Application for Dummies" book again, Examples and all. As I was doing that in my spare time while away from the computer I read "Android Apps for Absolute Beginners". I am put the books aside for now and concentrating on making my own app "Tic Tac Toe" for a while. I made a lot of progress today, it functions but still has some bugs. The look of it  I will be changing .After researching apps already out there I think the look it currently has is a bit outdated. One problem I am having is that when a win happens  it shows the Toast of who wins and resets the game before the last square changes to a circle or cross. I also need to make a horizontal layout or lock it in to just vertical. If you want to see the code so far , just leave a comment.

10,000 hour to Mastery.
10,000 - 386 = 9614 hours left