Changes in / [1a91f0d:3e9f39e] in galcon-client
- Files:
-
- 11 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
AndroidManifest.xml
r1a91f0d r3e9f39e 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 3 package="com.example.helloandroid" 4 android:versionCode="1" 5 android:versionName="1.0"> 6 <application android:icon="@drawable/icon" android:label="@string/app_name"> 7 <activity android:name=".HelloAndroid" 8 android:label="@string/app_name"> 3 package="com.example.helloandroid"> 4 <application android:icon="@drawable/app_lunar_lander" android:label="@string/app_name"> 5 <activity android:name="Game"> 9 6 <intent-filter> 10 7 <action android:name="android.intent.action.MAIN" /> 11 8 <category android:name="android.intent.category.LAUNCHER" /> 12 9 </intent-filter> 13 </activity> 14 10 </activity> 15 11 </application> 16 12 <uses-sdk android:minSdkVersion="7" /> 17 18 </manifest> 13 </manifest> -
res/layout/main.xml
r1a91f0d r3e9f39e 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 4 3 android:layout_width="fill_parent" 5 android:layout_height="fill_parent" 6 > 7 <TextView 8 android:layout_width="fill_parent" 9 android:layout_height="wrap_content" 10 android:text="@string/hello" 11 /> 12 </LinearLayout> 4 android:layout_height="fill_parent"> 5 6 <com.example.helloandroid.GameView 7 android:id="@+id/lunar" 8 android:layout_width="fill_parent" 9 android:layout_height="fill_parent"/> 10 11 <RelativeLayout 12 android:layout_width="fill_parent" 13 android:layout_height="fill_parent" > 14 <TextView 15 android:id="@+id/text" 16 android:text="@string/lunar_layout_text_text" 17 android:visibility="visible" 18 android:layout_width="wrap_content" 19 android:layout_height="wrap_content" 20 android:layout_centerInParent="true" 21 android:gravity="center_horizontal" 22 android:textColor="#88ffffff" 23 android:textSize="24sp"/> 24 </RelativeLayout> 25 26 </FrameLayout> -
res/values/strings.xml
r1a91f0d r3e9f39e 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 3 <resources> 4 <string name="app_name">Lunar Lander</string> 5 6 <string name="menu_start">Start</string> 7 <string name="menu_stop">Stop</string> 8 <string name="menu_pause">Pause</string> 9 <string name="menu_resume">Resume</string> 10 <string name="menu_easy">Easy</string> 11 <string name="menu_medium">Medium</string> 12 <string name="menu_hard">Hard</string> 13 14 <string name="mode_ready">Lunar Lander\nPress Up To Play</string> 15 <string name="mode_pause">Paused\nPress Up To Resume</string> 16 <string name="mode_lose">Game Over\nPress Up To Play</string> 17 <string name="mode_win_prefix">Success!\n</string> 18 <string name="mode_win_suffix">in a row\nPress Up to Play</string> 19 20 <string name="message_stopped">Stopped</string> 21 <string name="message_off_pad">Off Landing Pad</string> 22 <string name="message_too_fast">Too Fast</string> 23 <string name="message_bad_angle">Bad Angle</string> 24 25 <string name="lunar_layout_text_text"></string> 26 3 27 <string name="hello">Hello World, HelloAndroid!</string> 4 <string name="app_name">Hello, Android</string>5 28 </resources> -
src/com/example/helloandroid/Planet.java
r1a91f0d r3e9f39e 1 1 package com.example.helloandroid; 2 3 import java.util.ArrayList; 2 4 3 5 public class Planet { 4 6 int radius; 5 7 int regenRate; // ships per second 6 int x;7 int y;8 private int x; 9 private int y; 8 10 int faction; 9 11 int numShips; … … 27 29 } 28 30 31 public int getRadius() { 32 return radius; 33 } 34 35 public int getNumShips() { 36 return numShips; 37 } 38 39 public void setNumShips(int num) { 40 numShips = num; 41 } 42 29 43 public void update() { 30 44 //regen ships if not owned by faction 0 45 numShips++; 31 46 } 32 47 … … 34 49 35 50 } 51 52 public boolean collides(Planet p) { 53 double dist = Math.sqrt(Math.pow(this.x-p.x, 2) + Math.pow(this.y-p.y, 2)); 54 55 return dist <= this.radius + p.radius; 56 } 57 58 public static boolean collisionDetected(Planet p, ArrayList<Planet> curPlanets) { 59 for(Planet p2 : curPlanets) { 60 if(p.collides(p2)) 61 return true; 62 } 63 64 return false; 65 } 36 66 }
Note:
See TracChangeset
for help on using the changeset viewer.