Changes in / [3e9f39e:1a91f0d] in galcon-client
- Files:
-
- 1 added
- 11 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
AndroidManifest.xml
r3e9f39e r1a91f0d 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 <application android:icon="@drawable/app_lunar_lander" android:label="@string/app_name"> 5 <activity android:name="Game"> 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"> 6 9 <intent-filter> 7 10 <action android:name="android.intent.action.MAIN" /> 8 11 <category android:name="android.intent.category.LAUNCHER" /> 9 12 </intent-filter> 10 </activity> 13 </activity> 14 11 15 </application> 12 16 <uses-sdk android:minSdkVersion="7" /> 13 </manifest> 17 18 </manifest> -
res/layout/main.xml
r3e9f39e r1a91f0d 1 1 <?xml version="1.0" encoding="utf-8"?> 2 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:orientation="vertical" 3 4 android:layout_width="fill_parent" 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> 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> -
res/values/strings.xml
r3e9f39e r1a91f0d 1 1 <?xml version="1.0" encoding="utf-8"?> 2 3 2 <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 27 3 <string name="hello">Hello World, HelloAndroid!</string> 4 <string name="app_name">Hello, Android</string> 28 5 </resources> -
src/com/example/helloandroid/Planet.java
r3e9f39e r1a91f0d 1 1 package com.example.helloandroid; 2 3 import java.util.ArrayList;4 2 5 3 public class Planet { 6 4 int radius; 7 5 int regenRate; // ships per second 8 privateint x;9 privateint y;6 int x; 7 int y; 10 8 int faction; 11 9 int numShips; … … 29 27 } 30 28 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 43 29 public void update() { 44 30 //regen ships if not owned by faction 0 45 numShips++;46 31 } 47 32 … … 49 34 50 35 } 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 }66 36 }
Note:
See TracChangeset
for help on using the changeset viewer.