Source Code Cross Referenced for GameDesign.java in  » IDE-Netbeans » mobility » demo » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » mobility » demo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2007, Sun Microsystems, Inc.
003:         * 
004:         * All rights reserved.
005:         * 
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         * 
010:         *     * Redistributions of source code must retain the above copyright
011:         *       notice, this list of conditions and the following disclaimer.
012:         *     * Redistributions in binary form must reproduce the above copyright
013:         *       notice, this list of conditions and the following disclaimer in
014:         *       the documentation and/or other materials provided with the
015:         *       distribution.
016:         *     * Neither the name of Sun Microsystems, Inc. nor the names of its
017:         *       contributors may be used to endorse or promote products derived
018:         *       from this software without specific prior written permission.
019:         * 
020:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
021:         * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
022:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
023:         * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
024:         * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025:         * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026:         * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
027:         * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
028:         * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029:         * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
030:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031:         */
032:        package demo;
033:
034:        import javax.microedition.midlet.*;
035:        import javax.microedition.lcdui.*;
036:        import javax.microedition.lcdui.game.*;
037:
038:        /**
039:         * @author  Karel Herink
040:         * @version 1.0
041:         */
042:        public class GameDesign {
043:
044:            //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
045:            private Sprite Thomas;
046:            public int ThomasSeqWalkHorizDelay = 140;
047:            public int[] ThomasSeqWalkHoriz = { 80, 81, 82, 83 };
048:            public int ThomasSeqWalkVertDelay = 140;
049:            public int[] ThomasSeqWalkVert = { 84, 85, 86, 87 };
050:            private TiledLayer Things;
051:            private TiledLayer Water;
052:            public int AnimWaterWater;
053:            private Image platform_tiles;
054:            private Image topview_tiles;
055:            public int AnimWaterSeq001Delay = 200;
056:            public int[] AnimWaterSeq001 = { 71, 72, 73, 74, 75 };
057:            private Sprite Karel;
058:            public int KarelSeqWalkUpDelay = 150;
059:            public int[] KarelSeqWalkUp = { 94, 95, 96, 97 };
060:            public int KarelSeqWalkSideFastDelay = 100;
061:            public int[] KarelSeqWalkSideFast = { 100, 101, 102, 103 };
062:            public int KarelSeqWalkSideDelay = 150;
063:            public int[] KarelSeqWalkSide = { 100, 101, 102, 103 };
064:            public int KarelSeqWalkDownDelay = 150;
065:            public int[] KarelSeqWalkDown = { 88, 89, 90, 91 };
066:            private TiledLayer Base;
067:            private TiledLayer Trees;
068:
069:            //</editor-fold>//GEN-END:|fields|0|
070:
071:            //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
072:            //</editor-fold>//GEN-END:|methods|0|
073:
074:            public void updateLayerManagerForForest(LayerManager lm)
075:                    throws java.io.IOException {//GEN-LINE:|1-updateLayerManager|0|1-preUpdate
076:                // write pre-update user code here
077:                getKarel().setPosition(55, 43);//GEN-BEGIN:|1-updateLayerManager|1|1-postUpdate
078:                getKarel().setVisible(true);
079:                lm.append(getKarel());
080:                getThomas().setPosition(67, 80);
081:                getThomas().setVisible(true);
082:                lm.append(getThomas());
083:                getTrees().setPosition(191, 3);
084:                getTrees().setVisible(true);
085:                lm.append(getTrees());
086:                getThings().setPosition(16, 111);
087:                getThings().setVisible(true);
088:                lm.append(getThings());
089:                getWater().setPosition(109, 98);
090:                getWater().setVisible(true);
091:                lm.append(getWater());
092:                getBase().setPosition(0, 0);
093:                getBase().setVisible(true);
094:                lm.append(getBase());//GEN-END:|1-updateLayerManager|1|1-postUpdate
095:                // write post-update user code here
096:            }//GEN-BEGIN:|1-updateLayerManager|2|
097:
098:            //GEN-END:|1-updateLayerManager|2|
099:
100:            public Image getTopview_tiles() throws java.io.IOException {//GEN-BEGIN:|2-getter|0|2-preInit
101:                if (topview_tiles == null) {//GEN-END:|2-getter|0|2-preInit
102:                    // write pre-init user code here
103:                    topview_tiles = Image.createImage("/topview_tiles.png");//GEN-BEGIN:|2-getter|1|2-postInit
104:                }//GEN-END:|2-getter|1|2-postInit
105:                // write post-init user code here
106:                return this .topview_tiles;//GEN-BEGIN:|2-getter|2|
107:            }
108:
109:            //GEN-END:|2-getter|2|
110:
111:            public TiledLayer getWater() throws java.io.IOException {//GEN-BEGIN:|3-getter|0|3-preInit
112:                if (Water == null) {//GEN-END:|3-getter|0|3-preInit
113:                    // write pre-init user code here
114:                    Water = new TiledLayer(8, 6, getTopview_tiles(), 16, 16);//GEN-BEGIN:|3-getter|1|3-midInit
115:                    AnimWaterWater = Water
116:                            .createAnimatedTile(AnimWaterSeq001[0]);
117:                    int[][] tiles = {
118:                            { 0, 0, 44, 31, 31, 31, 31, 32 },
119:                            { 0, 0, 47, 59, AnimWaterWater, 59, AnimWaterWater,
120:                                    48 }, { 0, 0, 47, 59, 59, 61, 64, 45 },
121:                            { 0, 0, 47, 59, 59, 48, 0, 0 },
122:                            { 44, 31, 62, 59, 59, 48, 0, 0 },
123:                            { 46, 64, 64, 64, 64, 45, 0, 0 } };//GEN-END:|3-getter|1|3-midInit
124:                    // write mid-init user code here
125:                    for (int row = 0; row < 6; row++) {//GEN-BEGIN:|3-getter|2|3-postInit
126:                        for (int col = 0; col < 8; col++) {
127:                            Water.setCell(col, row, tiles[row][col]);
128:                        }
129:                    }
130:                }//GEN-END:|3-getter|2|3-postInit
131:                // write post-init user code here
132:                return Water;//GEN-BEGIN:|3-getter|3|
133:            }
134:
135:            //GEN-END:|3-getter|3|
136:
137:            public TiledLayer getBase() throws java.io.IOException {//GEN-BEGIN:|6-getter|0|6-preInit
138:                if (Base == null) {//GEN-END:|6-getter|0|6-preInit
139:                    // write pre-init user code here
140:                    Base = new TiledLayer(24, 23, getTopview_tiles(), 16, 16);//GEN-BEGIN:|6-getter|1|6-midInit
141:                    int[][] tiles = {
142:                            { 7, 3, 17, 6, 6, 6, 6, 35, 23, 16, 16, 16, 16, 16,
143:                                    16, 16, 16, 16, 16, 16, 16, 16, 16, 16 },
144:                            { 7, 3, 5, 16, 16, 16, 16, 26, 16, 16, 16, 16, 16,
145:                                    16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16 },
146:                            { 24, 6, 23, 16, 16, 16, 16, 26, 16, 16, 16, 16,
147:                                    16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
148:                                    16 },
149:                            { 16, 16, 16, 16, 16, 16, 16, 26, 16, 16, 16, 16,
150:                                    16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
151:                                    16 },
152:                            { 16, 16, 16, 16, 16, 16, 16, 26, 16, 16, 16, 11,
153:                                    11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
154:                                    16 },
155:                            { 16, 16, 16, 16, 16, 16, 16, 26, 16, 16, 16, 16,
156:                                    16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
157:                                    16 },
158:                            { 16, 15, 16, 16, 16, 16, 16, 30, 28, 16, 16, 16,
159:                                    16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
160:                                    16 },
161:                            { 16, 16, 15, 16, 16, 8, 16, 16, 26, 16, 16, 16,
162:                                    16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
163:                                    16 },
164:                            { 16, 16, 16, 16, 16, 16, 16, 16, 26, 16, 16, 16,
165:                                    16, 16, 16, 16, 16, 16, 14, 15, 16, 16, 16,
166:                                    16 },
167:                            { 16, 16, 16, 16, 16, 16, 16, 16, 30, 25, 25, 25,
168:                                    25, 28, 16, 16, 16, 16, 14, 16, 16, 16, 16,
169:                                    16 },
170:                            { 16, 16, 16, 16, 8, 16, 16, 11, 16, 16, 16, 16,
171:                                    16, 26, 16, 16, 16, 14, 16, 16, 15, 16, 16,
172:                                    16 },
173:                            { 16, 16, 16, 16, 16, 16, 11, 11, 11, 11, 16, 16,
174:                                    16, 26, 16, 16, 16, 16, 15, 16, 16, 16, 16,
175:                                    16 },
176:                            { 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 11, 16,
177:                                    16, 26, 16, 16, 16, 16, 16, 15, 15, 16, 16,
178:                                    16 },
179:                            { 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 11, 16,
180:                                    22, 36, 21, 16, 16, 16, 16, 16, 16, 16, 15,
181:                                    16 },
182:                            { 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 11, 16,
183:                                    7, 3, 5, 16, 16, 16, 16, 16, 16, 15, 16, 16 },
184:                            { 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 16, 27,
185:                                    34, 1, 5, 16, 16, 16, 16, 16, 14, 16, 16,
186:                                    16 },
187:                            { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 26,
188:                                    24, 6, 23, 16, 16, 16, 16, 16, 14, 16, 16,
189:                                    16 },
190:                            { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 26,
191:                                    16, 16, 16, 16, 16, 15, 14, 14, 16, 16, 16,
192:                                    16 },
193:                            { 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 29,
194:                                    16, 16, 16, 16, 16, 15, 15, 14, 16, 16, 16,
195:                                    16 },
196:                            { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
197:                                    16, 16, 16, 15, 15, 16, 16, 16, 16, 16, 16,
198:                                    16 },
199:                            { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
200:                                    16, 16, 15, 16, 16, 15, 16, 16, 16, 16, 16,
201:                                    16 },
202:                            { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
203:                                    16, 16, 16, 15, 16, 16, 16, 15, 16, 16, 16,
204:                                    16 },
205:                            { 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
206:                                    16, 16, 16, 16, 16, 16, 16, 15, 16, 16, 16,
207:                                    16 } };//GEN-END:|6-getter|1|6-midInit
208:                    // write mid-init user code here
209:                    for (int row = 0; row < 23; row++) {//GEN-BEGIN:|6-getter|2|6-postInit
210:                        for (int col = 0; col < 24; col++) {
211:                            Base.setCell(col, row, tiles[row][col]);
212:                        }
213:                    }
214:                }//GEN-END:|6-getter|2|6-postInit
215:                // write post-init user code here
216:                return Base;//GEN-BEGIN:|6-getter|3|
217:            }
218:
219:            //GEN-END:|6-getter|3|
220:
221:            public TiledLayer getThings() throws java.io.IOException {//GEN-BEGIN:|31-getter|0|31-preInit
222:                if (Things == null) {//GEN-END:|31-getter|0|31-preInit
223:                    // write pre-init user code here
224:                    Things = new TiledLayer(15, 15, getTopview_tiles(), 16, 16);//GEN-BEGIN:|31-getter|1|31-midInit
225:                    int[][] tiles = {
226:                            { 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0 },
227:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
228:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
229:                            { 0, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
230:                            { 0, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
231:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
232:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
233:                            { 0, 67, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0 },
234:                            { 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 },
235:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
236:                            { 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
237:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
238:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
239:                            { 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0 },
240:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };//GEN-END:|31-getter|1|31-midInit
241:                    // write mid-init user code here
242:                    for (int row = 0; row < 15; row++) {//GEN-BEGIN:|31-getter|2|31-postInit
243:                        for (int col = 0; col < 15; col++) {
244:                            Things.setCell(col, row, tiles[row][col]);
245:                        }
246:                    }
247:                }//GEN-END:|31-getter|2|31-postInit
248:                // write post-init user code here
249:                return Things;//GEN-BEGIN:|31-getter|3|
250:            }
251:
252:            //GEN-END:|31-getter|3|
253:
254:            public Sprite getThomas() throws java.io.IOException {//GEN-BEGIN:|51-getter|0|51-preInit
255:                if (Thomas == null) {//GEN-END:|51-getter|0|51-preInit
256:                    // write pre-init user code here
257:                    Thomas = new Sprite(getTopview_tiles(), 16, 16);//GEN-BEGIN:|51-getter|1|51-postInit
258:                    Thomas.setFrameSequence(ThomasSeqWalkVert);//GEN-END:|51-getter|1|51-postInit
259:                    // write post-init user code here
260:                }//GEN-BEGIN:|51-getter|2|
261:                return Thomas;
262:            }
263:
264:            //GEN-END:|51-getter|2|
265:
266:            public Sprite getKarel() throws java.io.IOException {//GEN-BEGIN:|70-getter|0|70-preInit
267:                if (Karel == null) {//GEN-END:|70-getter|0|70-preInit
268:                    // write pre-init user code here
269:                    Karel = new Sprite(getTopview_tiles(), 16, 16);//GEN-BEGIN:|70-getter|1|70-postInit
270:                    Karel.setFrameSequence(KarelSeqWalkDown);//GEN-END:|70-getter|1|70-postInit
271:                    // write post-init user code here
272:                }//GEN-BEGIN:|70-getter|2|
273:                return Karel;
274:            }
275:
276:            //GEN-END:|70-getter|2|
277:
278:            public Image getPlatform_tiles() throws java.io.IOException {//GEN-BEGIN:|161-getter|0|161-preInit
279:                if (platform_tiles == null) {//GEN-END:|161-getter|0|161-preInit
280:                    // write pre-init user code here
281:                    platform_tiles = Image.createImage("/platform_tiles.png");//GEN-BEGIN:|161-getter|1|161-postInit
282:                }//GEN-END:|161-getter|1|161-postInit
283:                // write post-init user code here
284:                return this .platform_tiles;//GEN-BEGIN:|161-getter|2|
285:            }
286:
287:            //GEN-END:|161-getter|2|
288:
289:            public TiledLayer getTrees() throws java.io.IOException {//GEN-BEGIN:|276-getter|0|276-preInit
290:                if (Trees == null) {//GEN-END:|276-getter|0|276-preInit
291:                    // write pre-init user code here
292:                    Trees = new TiledLayer(11, 22, getTopview_tiles(), 16, 16);//GEN-BEGIN:|276-getter|1|276-midInit
293:                    int[][] tiles = {
294:                            { 10, 10, 10, 10, 10, 10, 10, 0, 0, 0, 0 },
295:                            { 0, 12, 10, 10, 10, 10, 10, 10, 0, 0, 0 },
296:                            { 0, 12, 10, 12, 10, 10, 10, 10, 0, 10, 0 },
297:                            { 9, 0, 12, 10, 10, 10, 10, 10, 10, 10, 0 },
298:                            { 0, 0, 12, 12, 10, 10, 10, 10, 10, 10, 0 },
299:                            { 0, 0, 0, 12, 10, 10, 10, 10, 0, 0, 0 },
300:                            { 0, 0, 0, 12, 12, 10, 10, 10, 0, 0, 0 },
301:                            { 0, 0, 0, 12, 10, 10, 12, 0, 0, 0, 0 },
302:                            { 0, 0, 0, 0, 10, 10, 0, 0, 0, 0, 0 },
303:                            { 0, 0, 0, 0, 12, 10, 0, 0, 13, 0, 0 },
304:                            { 0, 0, 0, 12, 0, 0, 0, 0, 13, 0, 0 },
305:                            { 0, 0, 0, 0, 0, 0, 0, 0, 13, 13, 13 },
306:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13 },
307:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13 },
308:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
309:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
310:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
311:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
312:                            { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
313:                            { 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0 },
314:                            { 0, 0, 0, 0, 13, 13, 0, 0, 0, 0, 0 },
315:                            { 0, 0, 0, 13, 0, 13, 13, 13, 0, 0, 0 } };//GEN-END:|276-getter|1|276-midInit
316:                    // write mid-init user code here
317:                    for (int row = 0; row < 22; row++) {//GEN-BEGIN:|276-getter|2|276-postInit
318:                        for (int col = 0; col < 11; col++) {
319:                            Trees.setCell(col, row, tiles[row][col]);
320:                        }
321:                    }
322:                }//GEN-END:|276-getter|2|276-postInit
323:                // write post-init user code here
324:                return Trees;//GEN-BEGIN:|276-getter|3|
325:            }
326:            //GEN-END:|276-getter|3|
327:
328:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.