📄 yosamabin_n60.java
字号:
import com.nokia.mid.sound.Sound;
import com.nokia.mid.ui.DirectGraphics;
import com.nokia.mid.ui.DirectUtils;
import com.nokia.mid.ui.FullCanvas;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import javax.microedition.io.Connection;
import javax.microedition.io.Connector;
import javax.microedition.io.ContentConnection;
import javax.microedition.io.HttpConnection;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.TextField;
import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;
import javax.microedition.midlet.MIDlet;
public class YosamaBin_N60 extends MIDlet
{
Display display;
YosamaBin_N60.Intro intro;
YosamaBin_N60.GameCanvas obj;
YosamaBin_N60.SubmitPoints subPts;
YosamaBin_N60.ShowScore shwScr;
YosamaBin_N60.FieldMover mover;
Timer timer;
public boolean checkPause;
public boolean yes;
public boolean sound;
public static byte count;
public static byte gamePaint;
public static byte game;
public static byte gameend;
public static byte add;
public static int a;
public static int w;
public static int h;
public static int score;
public static int dn;
public static int dn1;
public static int menuanim;
public static int icount;
public static int level;
public static int i;
public String[] menu;
public String[] menu1;
public String[] game2play;
public String[] how2play;
public String[] about;
private static Player[] snd = new Player[6];
public InputStream[] istream;
String[] sndnm;
String[] sndty;
String store;
String temp1;
String name1;
String[] str;
int[] scr;
public int temp;
public int xch;
public YosamaBin_N60.Entername n1;
public TextField name;
public int ianim;
public int yosamax;
public int yosamay;
public int sanim;
public int janim;
public int danim;
public int wanim;
public int fireanim;
public int stone1x;
public int stone1y;
public int stone2x;
public int stone2y;
public int stone3x;
public int stone3y;
public int k;
public int dropsanim;
public int weight;
public int pieces;
public int motion;
public int gcounter;
public int man1x;
public int man1y;
public int man2x;
public int man2y;
public int bullet1x;
public int bullet1y;
public int bullet2x;
public int bullet2y;
public int wait1;
public int wait2;
public int textscr;
public int dside;
public int gap;
public int jumpx;
public int jumpy;
public int duckx;
public int ducky;
public int dindex;
public int dir;
public int hitcount;
public int lives;
public int parax;
public int paray;
public int side;
public int pboundry;
public int pdir;
public int fixedx;
public int fixedy;
public int pointx;
public int pointy;
public int points;
public int pcount;
public int[][] jumpindex;
public boolean left;
public boolean right;
public boolean up;
public boolean down;
public boolean fire;
public boolean go;
public boolean st1visible;
public boolean st2visible;
public boolean st3visible;
public boolean m1visible;
public boolean m2visible;
public boolean hit;
public boolean levelchanged;
public boolean maround;
public boolean paravisible;
public boolean explosion;
public boolean won;
public Image arrowl;
public Image arrowr;
public Image arrowu;
public Image arrowd;
public Image imintro;
public Image intro1;
public Image intro2;
public Image introhand1;
public Image introhand2;
public Image introhand3;
public Image over;
public Image bg;
public Image immenu;
public Image imhit;
public Image[] stand;
public Image[] standbr;
public Image[] jump;
public Image[] stone;
public Image[] walk;
public Image[] sol;
public Image[] bend;
public Image[] exp;
public Image[] drops;
public Image para;
public Image imscore;
public Image loading;
Random rd;
public YosamaBin_N60()
{
this.mover = new YosamaBin_N60.FieldMover(this);
this.timer = new Timer();
this.sound = true;
this.menu = { "Start2play", "Game2play", "How2play", "Sound(on)", "Top Score", "Hall of Fame", "About", "Exit" };
this.menu1 = { "Continue2play", "New Game", "Main Menu", "Exit" };
this.game2play = { "Yosama Bin’s laden in trouble as", "his world’s crumbling. The armed", "forces have united against him", "and are adamant to take Yosama", "Bin down!! But Yosama Bin ", "believes that there’s still some", "hope left. He wants to collect ", "the falling pieces of his ", "precious caves and rebuild his", "empire someday. So go on,", "help Yosama Bin gather rubble ", "and avoid trouble!" };
this.how2play = { "Make Yosama Bin stand under the ", "falling rubble to collect it.", "Press 4 or LEFT to move Yosama", "Bin left", "Press 6 or RIGHT to move Yosama", "Bin right", "Press 2 or UP to make Yosama Bin", "jump", "Press 8 or DOWN to make Yosama", "Bin duck", "Tips: Collect more points for the", "larger pieces of rubble. The more", "rubble Yosama Bin collects, the", "more he is laden with weight.", "Thus, his reflexes slow down." };
this.about = { "Copyright © Mobile2win Ltd.", "For any enquiries, send an", "email to support@mobile2win.com", "Visit us at www.mobile2win.com" };
this.istream = new InputStream[6];
this.sndnm = { "/intro.mid", "/bgtrack.mid", "/explode.wav", "/gunshot.wav", "/collect.mid", "/yosama_hit.mid" };
this.sndty = { "audio/midi", "audio/midi", "audio/x-wav", "audio/x-wav", "audio/midi", "audio/midi" };
this.str = { "A", "B", "C", "D", "E", "F" };
this.scr = { 0, 0, 0, 0, 0, 0 };
this.n1 = new YosamaBin_N60.Entername(this);
this.jumpindex = { { 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0 }, { 0, 10, 30, 20, 5 }, { 0, 15, 35, 25, 10 }, { 0, 20, 40, 30, 15 } };
System.out.println(this.sound);
this.intro = new YosamaBin_N60.Intro(this);
this.obj = new YosamaBin_N60.GameCanvas(this);
this.display = Display.getDisplay(this);
}
public void introanim(Graphics paramGraphics)
{
paramGraphics.drawImage(this.imintro, 0, 0, 0x10 | 0x4);
if (this.ianim < 5)
{
paramGraphics.drawImage(this.intro1, 46, 12, 0x10 | 0x4);
paramGraphics.drawImage(this.introhand1, 35 - this.ianim * 2, 94 - this.ianim * 3, 0x10 | 0x4);
}
else if ((this.ianim >= 5) && (this.ianim < 10))
{
paramGraphics.drawImage(this.intro1, 46, 12, 0x10 | 0x4);
paramGraphics.drawImage(this.introhand3, 5, 16, 0x10 | 0x4);
}
else if ((this.ianim >= 10) && (this.ianim < 22))
{
if (this.ianim % 4 < 2)
{
paramGraphics.drawImage(this.intro1, 46, 7, 0x10 | 0x4);
paramGraphics.drawImage(this.introhand3, 5, 16, 0x10 | 0x4);
}
else
{
paramGraphics.drawImage(this.intro1, 46, 12, 0x10 | 0x4);
paramGraphics.drawImage(this.introhand3, 5, 16, 0x10 | 0x4);
}
}
else if ((this.ianim >= 24) && (this.ianim < 28))
{
paramGraphics.drawImage(this.intro1, 46, 12, 0x10 | 0x4);
paramGraphics.drawImage(this.intro2, 46, 12, 0x10 | 0x4);
paramGraphics.drawImage(this.introhand3, 5, 16, 0x10 | 0x4);
}
else
{
paramGraphics.drawImage(this.intro1, 46, 12, 0x10 | 0x4);
paramGraphics.drawImage(this.introhand3, 5, 16, 0x10 | 0x4);
}
paramGraphics.drawImage(this.introhand2, 109, 80, 0x10 | 0x4);
this.ianim += 1;
}
public void drawstones(Graphics paramGraphics)
{
if (this.stone1y >= h)
{
this.st1visible = true;
if (level == 1)
this.stone1y = -10;
else if (level == 2)
this.stone1y = -100;
else if (level == 3)
this.stone1y = -450;
this.stone1x = (this.rd.nextInt() % 100);
if (this.stone1x < 0)
this.stone1x = (-this.stone1x);
this.stone1x += 25;
}
this.stone1y += 3;
if (this.stone2y >= h)
{
this.st2visible = true;
if (level == 1)
this.stone2y = -450;
else if (level == 2)
this.stone2y = -10;
else if (level == 3)
this.stone2y = -10;
else if (level == 4)
this.stone2y = -120;
this.stone2x = (this.rd.nextInt() % 100);
if (this.stone2x < 0)
this.stone2x = (-this.stone2x);
this.stone2x += 25;
}
this.stone2y += 4;
if (this.stone3y >= h)
{
this.st3visible = true;
if (level == 3)
this.stone3y = -360;
else if (level == 4)
this.stone3y = -10;
this.stone3x = (this.rd.nextInt() % 100);
if (this.stone3x < 0)
this.stone3x = (-this.stone3x);
this.stone3x += 25;
}
this.stone3y += 5;
if ((this.st1visible) && (!(this.down)) && (this.stone1x + this.stone[1].getWidth() / 4 > this.yosamax) && (this.stone1x + 3 * this.stone[1].getWidth() / 4 < this.yosamax + this.stand[1].getWidth()) && (this.stone1y > this.yosamay) && (this.stone1y + this.stone[1].getHeight() < this.yosamay + this.stand[1].getHeight() / 3))
{
this.st1visible = false;
this.weight += 5;
this.pieces += 1;
this.points = 5;
this.pointx = this.stone1x;
this.pointy = (this.stone1y - 10);
this.pcount = 0;
playsnd(4);
}
if ((this.st2visible) && (!(this.down)) && (this.stone2x + this.stone[2].getWidth() / 4 > this.yosamax) && (this.stone2x + 3 * this.stone[2].getWidth() / 4 < this.yosamax + this.stand[1].getWidth()) && (this.stone2y > this.yosamay) && (this.stone2y + this.stone[2].getHeight() < this.yosamay + this.stand[1].getHeight() / 3))
{
this.st2visible = false;
this.weight += 10;
this.pieces += 1;
this.points = 10;
this.pointx = this.stone2x;
this.pointy = (this.stone2y - 10);
this.pcount = 0;
playsnd(4);
}
if ((this.st3visible) && (!(this.down)) && (this.stone3x + this.stone[2].getWidth() / 4 > this.yosamax) && (this.stone3x + 3 * this.stone[3].getWidth() / 4 < this.yosamax + this.stand[1].getWidth()) && (this.stone3y > this.yosamay) && (this.stone3y + this.stone[3].getHeight() < this.yosamay + this.stand[1].getHeight() / 2))
{
this.st3visible = false;
this.weight += 15;
this.pieces += 1;
this.points = 15;
this.pointx = this.stone3x;
this.pointy = (this.stone3y - 10);
this.pcount = 0;
playsnd(4);
}
if (this.st1visible == true)
paramGraphics.drawImage(this.stone[1], this.stone1x, this.stone1y, 0x10 | 0x4);
if (this.st2visible == true)
paramGraphics.drawImage(this.stone[2], this.stone2x, this.stone2y, 0x10 | 0x4);
if (this.st3visible == true)
paramGraphics.drawImage(this.stone[3], this.stone3x, this.stone3y, 0x10 | 0x4);
}
public void yosamamov(Graphics paramGraphics, DirectGraphics paramDirectGraphics)
{
if (this.up)
{
if ((this.janim < 1) || (this.janim == 7))
{
if (this.dir == 1)
paramGraphics.drawImage(this.jump[1], this.yosamax, this.yosamay, 0x10 | 0x4);
else
paramDirectGraphics.drawImage(this.jump[1], this.yosamax, this.yosamay, 0x10 | 0x4, 8192);
this.jumpx = this.yosamax;
this.jumpy = (this.yosamay - this.jumpindex[this.motion][3]);
}
else if (this.janim == 1)
{
if (this.dir == 1)
{
paramGraphics.drawImage(this.jump[2], this.yosamax - 12, this.yosamay - this.jumpindex[this.motion][1], 0x10 | 0x4);
this.jumpx = (this.yosamax - 12);
}
else
{
paramDirectGraphics.drawImage(this.jump[2], this.yosamax, this.yosamay - this.jumpindex[this.motion][1], 0x10 | 0x4, 8192);
this.jumpx = this.yosamax;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -