Posts

Showing posts with the label game

Create Brain Overdrive Game in Android

Image
This is yet another game like the 123Game . This game generates a single character which may be a Vowel, a Consonant, an Odd Number or may be an Even Number. The theme is you will get 3 seconds for each questions, you have to select the right option for it. If selected the right one then you will get 3 marks and the game gets over if u opt a wrong one ! Screenshots[Demo] The Code: For Generating Characters: void calc() { es="02468";os="13579";vs="AEIOU";ks="BCDFGHJKLMNPQRSTVWXYZ";k=""; Random rand=new Random(); k=k+es.charAt(rand.nextInt((4 - 0) + 1)); k=k+os.charAt(rand.nextInt((4 - 0) + 1)); k=k+vs.charAt(rand.nextInt((4 - 0) + 1)); k=k+ks.charAt(rand.nextInt((20 - 0) + 1)); String input=k; List<Character> characters = new ArrayList<Character>(); for(char c:input.toCharArray()){ characters.add(c); } StringBuilder output = new StringBuilder(input.length()); ...

Create 1+2=3 Android Game

Image
This post will guide you to create a highly interactive 1+2=3 Game. This game is based on a simple logic. Basically you have 3 number 1,2,3 which will be shuffled each time with a randomly generated operator ( +,-,*,/ ) placed in between. Screenshots: Lets go through important section of the project. Code for fetching Highscore : public int chec() { SQLiteDatabase SQLiteDb = mh.getWritableDatabase(); String [] col1 = {"_id","score"}; int ch=0; Cursor cu1 = SQLiteDb.query("scr", col1, null, null, null, null, null); while(cu1.moveToNext()) { ch=Integer.parseInt(cu1.getString(1)); } return ch; } Code For Generating Expression : void calc() { String st="123",op="+-*/",z="",y=""; p=0; Random rand=new Random(); for(int i=0;i<3;i++) z=z+st.charAt(rand.nextInt((2 - 0) + 1)); for(int i=0;i<2;i++) y=y+op.charAt(rand.nextInt((3 - 0) + 1)); switch(...