wesselh
Gebruiker
- Lid geworden
- 2 mrt 2007
- Berichten
- 132
Hallo iedereen. Ik heb een gamemaker spelletje gemaakt en naar java omgezet.
Ik heb een hele reeks bestanden nu: Avoidy.java, basicgame.java, .., ..,
Heeft iemand een idee welk bestand ik moet openen in de browser en hoe?
Dit is Avoidy.java:
En dit is basicgame.java:
Ik heb een hele reeks bestanden nu: Avoidy.java, basicgame.java, .., ..,
Heeft iemand een idee welk bestand ik moet openen in de browser en hoe?

Dit is Avoidy.java:
HTML:
// Avoidy.java
// by
/*
/ Made in Game Maker 6.0 www.gamemaker.nl
/ Converted using G-java 1.05 beta 2 0.22 www.g-java.com
/ This program can be run as an applet or an application!
*/
import runner.basicgame;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.applet.*;
public class Avoidy extends JApplet {
boolean loading = true;
public Image loadingImage;
public void init() {
showStatus( "Made in G-java - www.g-java.com");
if(!isGreaterThanJDK14())
{
URL upgradeTarget;
try{
String targetURL = "http://www.netsoc.tcd.ie/~duncan/dev/java/upgrade.html";
System.out.println("Sorry you need java version 1.4+ to run this program. Redirecting to "+targetURL+" for a later version of java");
getAppletContext().showDocument(new URL(targetURL));
}catch(MalformedURLException mfe)
{
System.err.println("Malformed URL exception caught:"+mfe);
}
}
}
public static void main(String args[]) {
// check if the user is using 1.4 or higher
if(!isGreaterThanJDK14())
{
JOptionPane.showMessageDialog(null,"Please download the latest version of java.");
}
basicgame gme = new basicgame();
}
public void paint( Graphics g ) {
loadingImage = new ImageIcon(getClass().getResource("runner/loading.png")).getImage();
g.drawImage(loadingImage,0,0, null);
//if the game is loading
if (loading) {
//load the sprites
basicgame.load_Sprites();
//load the sounds
basicgame.load_Sounds();
// load all backgrounds here
basicgame.load_Backgrounds();
// load all fonts here
basicgame.load_Fonts();
loading = false;
URL u = getDocumentBase();
basicgame gme = new basicgame(u,this);
}
}
private static boolean isGreaterThanJDK14()
{
/*
(taken from http://h21007.www2.hp.com/dspp/tech/tech_TechDocumentDetailPage_IDX/1,1701,2156,00.html):
java.class.version property values:
JDK 1.1 45.3
JDK 1.2 46.0
JDK 1.3 47.0
JDK 1.4 48.0
*/
String v = System.getProperty("java.class.version");
String v2 = System.getProperty("java.version");
System.out.println("java.class.version:"+v);
System.out.println("java.version:"+v2);
try{
return (Double.valueOf(v).doubleValue() >= 48.0);
}catch(NumberFormatException nfe)
{
}
return false;
}
}
En dit is basicgame.java:
HTML:
// basicgame.java
// by GM_guru
// import the required classes
package runner;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.applet.*;
import java.lang.reflect.InvocationTargetException;
// the main class
public class basicgame {
//The Game Settings
GameSettings gs = new GameSettings();
public static JFrame f;
public static URL u;
public static String Runningas;
public static RoomPanel Current_room;
public static JApplet Eapplet;
public static int mouse;
// Declare the reasources
public static sound[] sound = new sound[5];
public static sprite[] sprite = new sprite[14];
public static Background[] background = new Background[3];
public static font[] font = new font[1];
public static Objects[] obj = new Objects[20];
public basicgame(URL u) {
// if it is an applet
this.Runningas = "Applet";
this.mouse = 30;
this.u = u;
// load Functions
Functions func = new Functions();
// create a new frame that will be the game window
new load_Rooms(load_Rooms.firstroom);
}
public basicgame(URL u, JApplet embed) {
// if it is an embedded applet
this.Runningas = "EApplet";
this.mouse = 0;
Eapplet = embed;
this.u = u;
// load Functions
Functions func = new Functions();
new load_Rooms(load_Rooms.firstroom,embed);
}
public basicgame() {
// if it is an application
this.Runningas = "Application";
this.mouse = 30;
// load Functions
Functions func = new Functions();
// create a new frame that will be the game window
JFrame f = new Room(332,92, false, gs.Outsidecolor);
// center the room onscreen
Room.center(f);
f.getContentPane().add("Center",new StartPanel(f, gs.loading_image));
f.show();
}
public static void load_Sprites() {
// load all the sprites here
sprite[0] = new sprite("spr_Bal",1,1,0,1,10,11,2,20,2,20,1,24,24);
sprite[1] = new sprite("spr_Vijand",1,1,0,1,10,12,2,20,2,20,1,24,24);
sprite[2] = new sprite("spr_Muur",0,1,0,1,0,0,0,15,0,15,1,16,16);
sprite[3] = new sprite("spr_Blok",0,1,0,1,0,0,0,15,0,15,1,16,16);
sprite[4] = new sprite("spr_Geld",1,1,0,1,0,0,0,31,0,31,1,32,32);
sprite[5] = new sprite("spr_Titel",1,1,0,1,0,0,109,208,23,52,1,64,320);
sprite[6] = new sprite("spr_Start1",0,1,0,1,0,0,0,63,0,31,1,32,64);
sprite[7] = new sprite("spr_Start2",0,1,0,1,0,0,0,63,0,31,1,32,64);
sprite[8] = new sprite("spr_Clear1",0,1,0,1,0,0,0,63,0,31,1,32,64);
sprite[9] = new sprite("spr_Clear2",0,1,0,1,0,0,0,63,0,31,1,32,64);
sprite[10] = new sprite("spr_Muis",1,1,0,1,10,12,2,20,2,20,1,24,24);
sprite[11] = new sprite("spr_Instructie1",0,1,0,1,0,0,0,127,0,31,1,32,128);
sprite[12] = new sprite("spr_Instructie2",0,1,0,1,0,0,0,127,0,31,1,32,128);
}
public static void load_Sounds() {
// load all the sounds here
sound[0] = new sound("snd_Muurtik.wav",1,0,1,0);
sound[1] = new sound("snd_Baltik.wav",1,0,1,0);
sound[2] = new sound("snd_Geld.wav",1,0,1,-0,14);
sound[3] = new sound("snd_Background.mp3",1,0,1,0);
}
public static void close_sounds() {
sound[0].stop();
sound[1].stop();
sound[2].stop();
sound[3].stop();
}
public static void load_Backgrounds() {
// load all the backgrounds here
background[0] = new Background("bkg_background0",480,640,0,0,0,0,16,16,0,0,0,0);
background[1] = new Background("bkg_background1",64,64,0,0,0,0,16,16,0,0,0,0);
}
public static void load_Fonts() {
// load all the fonts here
}
public static Objects load_Objects(int objectid, int X, int Y, double id) {
// load all the objects here
if (objectid == 0) {
obj[0] = new obj_Bal(X,Y,0,id);
}
if (objectid == 1) {
obj[1] = new obj_Vijand(X,Y,1,id);
}
if (objectid == 2) {
obj[2] = new obj_Muur(X,Y,2,id);
}
if (objectid == 3) {
obj[3] = new obj_Blok(X,Y,3,id);
}
if (objectid == 4) {
obj[4] = new obj_Geld1(X,Y,4,id);
}
if (objectid == 5) {
obj[5] = new obj_Geld2(X,Y,5,id);
}
if (objectid == 6) {
obj[6] = new obj_Geld3(X,Y,6,id);
}
if (objectid == 7) {
obj[7] = new obj_Geld4(X,Y,7,id);
}
if (objectid == 8) {
obj[8] = new obj_Geld5(X,Y,8,id);
}
if (objectid == 9) {
obj[9] = new obj_Score(X,Y,9,id);
}
if (objectid == 10) {
obj[10] = new obj_Nieuwe_bal(X,Y,10,id);
}
if (objectid == 11) {
obj[11] = new obj_Titel(X,Y,11,id);
}
if (objectid == 12) {
obj[12] = new obj_Start(X,Y,12,id);
}
if (objectid == 13) {
obj[13] = new obj_Clear(X,Y,13,id);
}
if (objectid == 14) {
obj[14] = new obj_Muis(X,Y,14,id);
}
if (objectid == 16) {
obj[16] = new obj_Instructie(X,Y,16,id);
}
if (objectid == 18) {
obj[18] = new obj_Snow(X,Y,18,id);
}
return obj[objectid];
}
}
class obj_Bal extends Objects {
obj_Bal(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Bal", basicgame.sprite[0], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Create_event() {
// action_sound
basicgame.sound[3].play();
{
// action_set_caption
GameSettings.show_score = false;
GameSettings.score_caption = "score: ";
GameSettings.show_lives = false;
GameSettings.lives_caption = "lives: ";
GameSettings.show_health = false;
GameSettings.health_caption = "health: ";
basicgame.Current_room.Update_caption();
}
}
public void Alarm() {
if (alarm[1] == 0) {
// action_message
{
Functions.show_message("Game over! Try again!");
}
{
// action_highscore_show
HighScore mainFrame = new HighScore(-1, 1, 0, 255);
mainFrame.setVisible( true );
}
// action_restart_game
{
{
locali = basicgame.Current_room.id;
if (basicgame.Runningas != "EApplet") {
load_Rooms.change_room(load_Rooms.firstroom);
} else {
load_Rooms.change_room(load_Rooms.firstroom,basicgame.Eapplet);
}
load_Rooms.remove_room(locali);
}
}
}
if (alarm[0] == 0) {
{
// create the instance
basicgame.Current_room.instances.add(0, basicgame.load_Objects(1,208,208,GameSettings.instance_id + 1));
basicgame.Current_room.instance_id += 1;
GameSettings.instance_id += 1;
basicgame.Current_room.SortDepth();
}
}
}
public void Step() {
{
// move to a position
X = mouse_x;
Y = mouse_y;
}
}
public void Collision_event() {
Rectangle thisBounds = getBounds(X,Y);
ii = 0;
while (ii < basicgame.Current_room.instances.size()) {
Objects o = (Objects)basicgame.Current_room.instances.get(ii);
r1 = o.getBounds(o.X,o.Y);
if (o.id == 3 || o.parent == 3) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
// action_set_alarm
alarm[0] = 25;
}
}
if (o.id == 2 || o.parent == 2) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
{
// move to a position
X = X + 0;
Y = Y + 0;
}
{
dir = random.nextInt(-1);
}
}
}
if (o.id == 1 || o.parent == 1) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 1) {
// action_effect
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 4) {
// action_effect
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 5) {
// action_effect
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 6) {
// action_effect
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 7) {
// action_effect
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 8) {
// action_effect
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 2) {
{
// destroy the instance
jii = 0;
while (jii < basicgame.Current_room.instances.size()) {
dt = (Objects)basicgame.Current_room.instances.get(jii);
if (dt.id == 2) {
// run the destory event
Objects ooo = (Objects)basicgame.Current_room.instances.get(ii);
ooo.Destroy_event();
basicgame.Current_room.instances.remove(jii);
} else {
jii++;
}
}
}
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 3) {
{
// destroy the instance
jii = 0;
while (jii < basicgame.Current_room.instances.size()) {
dt = (Objects)basicgame.Current_room.instances.get(jii);
if (dt.id == 3) {
// run the destory event
Objects ooo = (Objects)basicgame.Current_room.instances.get(ii);
ooo.Destroy_event();
basicgame.Current_room.instances.remove(jii);
} else {
jii++;
}
}
}
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 10) {
{
// destroy the instance
jii = 0;
while (jii < basicgame.Current_room.instances.size()) {
dt = (Objects)basicgame.Current_room.instances.get(jii);
if (dt.id == 10) {
// run the destory event
Objects ooo = (Objects)basicgame.Current_room.instances.get(ii);
ooo.Destroy_event();
basicgame.Current_room.instances.remove(jii);
} else {
jii++;
}
}
}
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 1) {
{
// Set vspeed
obje.vspeed2 = 10;
obje.vspeed = (int)vspeed2;
}
}
applies_ii += 1;
}
{
// Set vspeed
vspeed2 = 10;
vspeed = (int)vspeed2;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 4) {
{
// Set vspeed
obje.vspeed2 = 10;
obje.vspeed = (int)vspeed2;
}
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 5) {
{
// Set vspeed
obje.vspeed2 = 10;
obje.vspeed = (int)vspeed2;
}
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 6) {
{
// Set vspeed
obje.vspeed2 = 10;
obje.vspeed = (int)vspeed2;
}
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 7) {
{
// Set vspeed
obje.vspeed2 = 10;
obje.vspeed = (int)vspeed2;
}
}
applies_ii += 1;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 8) {
{
// Set vspeed
obje.vspeed2 = 10;
obje.vspeed = (int)vspeed2;
}
}
applies_ii += 1;
}
// action_set_alarm
alarm[1] = 80;
}
}
ii++;
}
}
public void Outside() {
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 0) {
{
// move to a position
X = 320;
Y = 240;
}
}
applies_ii += 1;
}
}
}
class obj_Vijand extends Objects {
obj_Vijand(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Vijand", basicgame.sprite[1], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Create_event() {
{
dir = random.nextInt(3);
if (dir == 0) {
hspeed2 = -8;
vspeed2 = 8;
vspeed = (int)vspeed2;
hspeed = (int)hspeed2;
}
if (dir == 1) {
hspeed2 = 8;
vspeed2 = 8;
vspeed = (int)vspeed2;
hspeed = (int)hspeed2;
}
if (dir == 2) {
hspeed2 = - 8;
vspeed2 = - 8;
vspeed = (int)vspeed2;
hspeed = (int)hspeed2;
}
if (dir == 3) {
hspeed2 = 8;
vspeed2 = - 8;
vspeed = (int)vspeed2;
hspeed = (int)hspeed2;
}
}
}
public void Alarm() {
}
}
class obj_Muur extends Objects {
obj_Muur(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Muur", basicgame.sprite[2], null, 0, 1, 0, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Collision_event() {
Rectangle thisBounds = getBounds(X,Y);
ii = 0;
while (ii < basicgame.Current_room.instances.size()) {
Objects o = (Objects)basicgame.Current_room.instances.get(ii);
r1 = o.getBounds(o.X,o.Y);
if (o.id == 1 || o.parent == 1) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
// action_effect
{
// bounce
hspeed = -hspeed;
vspeed = -vspeed;
}
// action_sound
basicgame.sound[0].play();
}
}
ii++;
}
}
}
class obj_Blok extends Objects {
obj_Blok(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Blok", basicgame.sprite[3], null, 0, 0, 0, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
}
class obj_Geld1 extends Objects {
obj_Geld1(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Geld1", basicgame.sprite[4], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Collision_event() {
Rectangle thisBounds = getBounds(X,Y);
ii = 0;
while (ii < basicgame.Current_room.instances.size()) {
Objects o = (Objects)basicgame.Current_room.instances.get(ii);
r1 = o.getBounds(o.X,o.Y);
if (o.id == 0 || o.parent == 0) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
// action_sound
basicgame.sound[2].play();
{
// action_set_score
Functions.score = String.valueOf(Integer.parseInt(Functions.score) + + 5);
basicgame.Current_room.Update_caption();
}
// action_effect
{
// destroy the instance
this.Destroy_event();
basicgame.Current_room.instances.remove(basicgame.Current_room.instance_id);
basicgame.Current_room.instance_id--;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 10) {
// action_set_alarm
alarm[0] = 100;
}
applies_ii += 1;
}
}
}
ii++;
}
}
}
class obj_Geld2 extends Objects {
obj_Geld2(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Geld2", basicgame.sprite[4], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Collision_event() {
Rectangle thisBounds = getBounds(X,Y);
ii = 0;
while (ii < basicgame.Current_room.instances.size()) {
Objects o = (Objects)basicgame.Current_room.instances.get(ii);
r1 = o.getBounds(o.X,o.Y);
if (o.id == 0 || o.parent == 0) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
// action_sound
basicgame.sound[2].play();
{
// action_set_score
Functions.score = String.valueOf(Integer.parseInt(Functions.score) + + 5);
basicgame.Current_room.Update_caption();
}
// action_effect
{
// destroy the instance
this.Destroy_event();
basicgame.Current_room.instances.remove(basicgame.Current_room.instance_id);
basicgame.Current_room.instance_id--;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 10) {
// action_set_alarm
alarm[1] = 100;
}
applies_ii += 1;
}
}
}
ii++;
}
}
}
class obj_Geld3 extends Objects {
obj_Geld3(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Geld3", basicgame.sprite[4], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Collision_event() {
Rectangle thisBounds = getBounds(X,Y);
ii = 0;
while (ii < basicgame.Current_room.instances.size()) {
Objects o = (Objects)basicgame.Current_room.instances.get(ii);
r1 = o.getBounds(o.X,o.Y);
if (o.id == 0 || o.parent == 0) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
// action_sound
basicgame.sound[2].play();
{
// action_set_score
Functions.score = String.valueOf(Integer.parseInt(Functions.score) + + 5);
basicgame.Current_room.Update_caption();
}
// action_effect
{
// destroy the instance
this.Destroy_event();
basicgame.Current_room.instances.remove(basicgame.Current_room.instance_id);
basicgame.Current_room.instance_id--;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 10) {
// action_set_alarm
alarm[2] = 100;
}
applies_ii += 1;
}
}
}
ii++;
}
}
}
class obj_Geld4 extends Objects {
obj_Geld4(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Geld4", basicgame.sprite[4], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Collision_event() {
Rectangle thisBounds = getBounds(X,Y);
ii = 0;
while (ii < basicgame.Current_room.instances.size()) {
Objects o = (Objects)basicgame.Current_room.instances.get(ii);
r1 = o.getBounds(o.X,o.Y);
if (o.id == 0 || o.parent == 0) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
// action_sound
basicgame.sound[2].play();
{
// action_set_score
Functions.score = String.valueOf(Integer.parseInt(Functions.score) + + 5);
basicgame.Current_room.Update_caption();
}
// action_effect
{
// destroy the instance
this.Destroy_event();
basicgame.Current_room.instances.remove(basicgame.Current_room.instance_id);
basicgame.Current_room.instance_id--;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 10) {
// action_set_alarm
alarm[3] = 100;
}
applies_ii += 1;
}
}
}
ii++;
}
}
}
class obj_Geld5 extends Objects {
obj_Geld5(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Geld5", basicgame.sprite[4], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Collision_event() {
Rectangle thisBounds = getBounds(X,Y);
ii = 0;
while (ii < basicgame.Current_room.instances.size()) {
Objects o = (Objects)basicgame.Current_room.instances.get(ii);
r1 = o.getBounds(o.X,o.Y);
if (o.id == 0 || o.parent == 0) {
if (r1.intersects(thisBounds)) {
if (this.solid ==1 || o.solid == 1) {
X = xprevious;
Y = yprevious;
}
// action_sound
basicgame.sound[2].play();
{
// action_set_score
Functions.score = String.valueOf(Integer.parseInt(Functions.score) + + 5);
basicgame.Current_room.Update_caption();
}
// action_effect
{
// destroy the instance
this.Destroy_event();
basicgame.Current_room.instances.remove(basicgame.Current_room.instance_id);
basicgame.Current_room.instance_id--;
}
//applies to an object
applies_ii = 0;
while (applies_ii < (basicgame.Current_room.instances.size())) {
Objects obje = (Objects)basicgame.Current_room.instances.get(applies_ii);
if (obje.id == 10) {
// action_set_alarm
alarm[4] = 100;
}
applies_ii += 1;
}
}
}
ii++;
}
}
}
class obj_Score extends Objects {
obj_Score(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Score", null, null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Create_event() {
{
// action_set_score
Functions.score = "0";
basicgame.Current_room.Update_caption();
}
}
public void Alarm() {
}
public void Draw_event( Graphics g ) {
if (Object_visible == 1) {
Graphics comp2D = (Graphics2D)g;
g.setColor( Color.black );
{
// action_draw_score
g.drawString(Functions.score,3,3);
}
}
}
}
class obj_Nieuwe_bal extends Objects {
obj_Nieuwe_bal(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Nieuwe_bal", null, null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
if (alarm[4] == 0) {
{
// create the instance
basicgame.Current_room.instances.add(0, basicgame.load_Objects(8,304,224,GameSettings.instance_id + 1));
basicgame.Current_room.instance_id += 1;
GameSettings.instance_id += 1;
basicgame.Current_room.SortDepth();
}
}
if (alarm[3] == 0) {
{
// create the instance
basicgame.Current_room.instances.add(0, basicgame.load_Objects(7,544,80,GameSettings.instance_id + 1));
basicgame.Current_room.instance_id += 1;
GameSettings.instance_id += 1;
basicgame.Current_room.SortDepth();
}
}
if (alarm[2] == 0) {
{
// create the instance
basicgame.Current_room.instances.add(0, basicgame.load_Objects(6,544,384,GameSettings.instance_id + 1));
basicgame.Current_room.instance_id += 1;
GameSettings.instance_id += 1;
basicgame.Current_room.SortDepth();
}
}
if (alarm[1] == 0) {
{
// create the instance
basicgame.Current_room.instances.add(0, basicgame.load_Objects(5,64,384,GameSettings.instance_id + 1));
basicgame.Current_room.instance_id += 1;
GameSettings.instance_id += 1;
basicgame.Current_room.SortDepth();
}
}
if (alarm[0] == 0) {
{
// create the instance
basicgame.Current_room.instances.add(0, basicgame.load_Objects(4,80,80,GameSettings.instance_id + 1));
basicgame.Current_room.instance_id += 1;
GameSettings.instance_id += 1;
basicgame.Current_room.SortDepth();
}
}
}
}
class obj_Titel extends Objects {
obj_Titel(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Titel", basicgame.sprite[5], null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
}
class obj_Start extends Objects {
obj_Start(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Start", basicgame.sprite[6], null, 2, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
if (keycode == 11) {
// action_sprite_set
Object_sprite = basicgame.sprite[6];
subimage = 0;
}
if (keycode == 10) {
// action_sprite_set
Object_sprite = basicgame.sprite[7];
subimage = 0;
}
}
if ((thisBounds.contains(xx,yy-basicgame.mouse))&&(keycode == 1)) {
// action_another_room
{
locali = basicgame.Current_room.id;
if (basicgame.Runningas != "EApplet") {
load_Rooms.change_room(0);
} else {
load_Rooms.change_room(0,basicgame.Eapplet);
}
load_Rooms.remove_room(locali);
}
}
}
class obj_Clear extends Objects {
obj_Clear(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Clear", basicgame.sprite[8], null, 3, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
if (keycode == 11) {
// action_sprite_set
Object_sprite = basicgame.sprite[8];
subimage = 0;
}
if (keycode == 10) {
// action_sprite_set
Object_sprite = basicgame.sprite[9];
subimage = 0;
}
}
if ((thisBounds.contains(xx,yy-basicgame.mouse))&&(keycode == 1)) {
{
// action_highscore_clear
}
}
}
class obj_Muis extends Objects {
obj_Muis(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Muis", basicgame.sprite[10], null, 1, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Step() {
{
// move to a position
X = mouse_x;
Y = mouse_y;
}
}
}
class obj_Instructie extends Objects {
obj_Instructie(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Instructie", basicgame.sprite[11], null, 4, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
if (keycode == 11) {
// action_sprite_set
Object_sprite = basicgame.sprite[11];
subimage = 0;
}
if (keycode == 10) {
// action_sprite_set
Object_sprite = basicgame.sprite[12];
subimage = 0;
}
}
if ((thisBounds.contains(xx,yy-basicgame.mouse))&&(keycode == 1)) {
// action_message
{
Functions.show_message("Avoid the red balls with your mouse and pick up the coins to earn points. Touch Clear to erase the Highscore list. Thats it.");
}
}
}
class obj_Snow extends Objects {
obj_Snow(int X, int Y, int objid, double instance_id) {
super(objid, "obj_Snow", null, null, 0, 0, 1, -100, true);
this.X = X;
this.Y = Y;
this.xstart = X;
this.ystart = Y;
this.instance_id = instance_id;
}
public void Alarm() {
}
public void Step() {
// action_effect
//This action is only available in the registered version
}
}
class rm_Avoidy extends RoomPanel implements KeyListener,MouseListener {
public Objects o;
public int roomsetup=0;
private int ii, dd;
JFrame R;
public static Vector backgrounds = new Vector();
rm_Avoidy (JFrame R, int id,int roomid) {
super(R, "Avoidy", 30, 640, 480, new Color(192,192,192));
this.R = R;
this.id = id;
this.roomid = roomid;
if (basicgame.Runningas != "EApplet") {
R.addKeyListener(this);
R.addMouseListener(this);
} else {
basicgame.Eapplet.addKeyListener(this);
basicgame.Eapplet.addMouseListener(this);
}
}
public void setup_Room() {
//setup variables
hspeed0 = 0;
hspeed1 = 0;
hspeed2 = 0;
hspeed3 = 0;
hspeed4 = 0;
hspeed5 = 0;
hspeed6 = 0;
hspeed7 = 0;
vspeed0 = 0;
vspeed1 = 0;
vspeed2 = 0;
vspeed3 = 0;
vspeed4 = 0;
vspeed5 = 0;
vspeed6 = 0;
vspeed7 = 0;
Xpos0 = 0 - basicgame.background[0].back_width;
Xpos1 = 0;
Xpos2 = 0;
Xpos3 = 0;
Xpos4 = 0;
Xpos5 = 0;
Xpos6 = 0;
Xpos7 = 0;
Ypos0 = 0 - basicgame.background[0].back_height;
Ypos1 = 0;
Ypos2 = 0;
Ypos3 = 0;
Ypos4 = 0;
Ypos5 = 0;
Ypos6 = 0;
Ypos7 = 0;
// create all the objects backgrounds tiles etc
// vector of instances
instances = new Vector(179);
instances.add(0, basicgame.load_Objects(2,0,0,100013));
instances.add(0, basicgame.load_Objects(2,0,96,100019));
instances.add(0, basicgame.load_Objects(2,0,112,100020));
instances.add(0, basicgame.load_Objects(2,0,144,100022));
instances.add(0, basicgame.load_Objects(2,0,128,100023));
instances.add(0, basicgame.load_Objects(2,0,160,100024));
instances.add(0, basicgame.load_Objects(2,0,176,100025));
instances.add(0, basicgame.load_Objects(2,0,192,100026));
instances.add(0, basicgame.load_Objects(2,16,0,100027));
instances.add(0, basicgame.load_Objects(2,32,0,100028));
instances.add(0, basicgame.load_Objects(2,48,0,100029));
instances.add(0, basicgame.load_Objects(2,64,0,100030));
instances.add(0, basicgame.load_Objects(2,80,0,100031));
instances.add(0, basicgame.load_Objects(2,96,0,100032));
instances.add(0, basicgame.load_Objects(2,112,0,100033));
instances.add(0, basicgame.load_Objects(2,0,208,100034));
instances.add(0, basicgame.load_Objects(2,0,224,100035));
instances.add(0, basicgame.load_Objects(2,0,240,100036));
instances.add(0, basicgame.load_Objects(2,0,256,100037));
instances.add(0, basicgame.load_Objects(2,0,272,100038));
instances.add(0, basicgame.load_Objects(2,0,288,100039));
instances.add(0, basicgame.load_Objects(2,0,304,100040));
instances.add(0, basicgame.load_Objects(2,0,320,100041));
instances.add(0, basicgame.load_Objects(2,0,336,100042));
instances.add(0, basicgame.load_Objects(2,0,352,100043));
instances.add(0, basicgame.load_Objects(2,0,368,100044));
instances.add(0, basicgame.load_Objects(2,0,384,100045));
instances.add(0, basicgame.load_Objects(2,0,400,100046));
instances.add(0, basicgame.load_Objects(2,0,416,100047));
instances.add(0, basicgame.load_Objects(2,0,432,100048));
instances.add(0, basicgame.load_Objects(2,0,448,100049));
instances.add(0, basicgame.load_Objects(2,0,464,100050));
instances.add(0, basicgame.load_Objects(2,16,464,100051));
instances.add(0, basicgame.load_Objects(2,32,464,100052));
instances.add(0, basicgame.load_Objects(2,48,464,100053));
instances.add(0, basicgame.load_Objects(2,64,464,100054));
instances.add(0, basicgame.load_Objects(2,80,464,100055));
instances.add(0, basicgame.load_Objects(2,96,464,100056));
instances.add(0, basicgame.load_Objects(2,112,464,100057));
instances.add(0, basicgame.load_Objects(2,128,464,100058));
instances.add(0, basicgame.load_Objects(2,144,464,100059));
instances.add(0, basicgame.load_Objects(2,160,464,100060));
instances.add(0, basicgame.load_Objects(2,176,464,100061));
instances.add(0, basicgame.load_Objects(2,192,464,100062));
instances.add(0, basicgame.load_Objects(2,208,464,100063));
instances.add(0, basicgame.load_Objects(2,224,464,100064));
instances.add(0, basicgame.load_Objects(2,240,464,100065));
instances.add(0, basicgame.load_Objects(2,256,464,100066));
instances.add(0, basicgame.load_Objects(2,288,464,100067));
instances.add(0, basicgame.load_Objects(2,272,464,100068));
instances.add(0, basicgame.load_Objects(2,304,464,100069));
instances.add(0, basicgame.load_Objects(2,320,464,100070));
instances.add(0, basicgame.load_Objects(2,336,464,100071));
instances.add(0, basicgame.load_Objects(2,352,464,100072));
instances.add(0, basicgame.load_Objects(2,368,464,100074));
instances.add(0, basicgame.load_Objects(2,384,464,100075));
instances.add(0, basicgame.load_Objects(2,400,464,100076));
instances.add(0, basicgame.load_Objects(2,416,464,100077));
instances.add(0, basicgame.load_Objects(2,432,464,100078));
instances.add(0, basicgame.load_Objects(2,448,464,100079));
instances.add(0, basicgame.load_Objects(2,464,464,100080));
instances.add(0, basicgame.load_Objects(2,480,464,100081));
instances.add(0, basicgame.load_Objects(2,496,464,100082));
instances.add(0, basicgame.load_Objects(2,512,464,100083));
instances.add(0, basicgame.load_Objects(2,528,464,100084));
instances.add(0, basicgame.load_Objects(2,544,464,100085));
instances.add(0, basicgame.load_Objects(2,576,464,100086));
instances.add(0, basicgame.load_Objects(2,560,464,100087));
instances.add(0, basicgame.load_Objects(2,592,464,100088));
instances.add(0, basicgame.load_Objects(2,608,464,100089));
instances.add(0, basicgame.load_Objects(2,624,464,100090));
instances.add(0, basicgame.load_Objects(2,624,448,100091));
instances.add(0, basicgame.load_Objects(2,624,432,100092));
instances.add(0, basicgame.load_Objects(2,624,416,100093));
instances.add(0, basicgame.load_Objects(2,624,400,100094));
instances.add(0, basicgame.load_Objects(2,624,384,100095));
instances.add(0, basicgame.load_Objects(2,624,368,100096));
instances.add(0, basicgame.load_Objects(2,624,352,100097));
instances.add(0, basicgame.load_Objects(2,624,336,100098));
instances.add(0, basicgame.load_Objects(2,624,320,100099));
instances.add(0, basicgame.load_Objects(2,624,304,100100));
instances.add(0, basicgame.load_Objects(2,624,288,100101));
instances.add(0, basicgame.load_Objects(2,624,272,100102));
instances.add(0, basicgame.load_Objects(2,624,256,100103));
instances.add(0, basicgame.load_Objects(2,624,240,100104));
instances.add(0, basicgame.load_Objects(2,624,224,100105));
instances.add(0, basicgame.load_Objects(2,624,208,100106));
instances.add(0, basicgame.load_Objects(2,624,192,100107));
instances.add(0, basicgame.load_Objects(2,624,176,100108));
instances.add(0, basicgame.load_Objects(2,624,160,100109));
instances.add(0, basicgame.load_Objects(2,624,144,100110));
instances.add(0, basicgame.load_Objects(2,624,128,100111));
instances.add(0, basicgame.load_Objects(2,624,112,100112));
instances.add(0, basicgame.load_Objects(2,624,96,100113));
instances.add(0, basicgame.load_Objects(2,624,80,100114));
instances.add(0, basicgame.load_Objects(2,624,64,100115));
instances.add(0, basicgame.load_Objects(2,624,48,100116));
instances.add(0, basicgame.load_Objects(2,624,32,100117));
instances.add(0, basicgame.load_Objects(2,624,16,100118));
instances.add(0, basicgame.load_Objects(2,624,0,100119));
instances.add(0, basicgame.load_Objects(2,608,0,100120));
instances.add(0, basicgame.load_Objects(2,592,0,100121));
instances.add(0, basicgame.load_Objects(2,576,0,100122));
instances.add(0, basicgame.load_Objects(2,560,0,100123));
instances.add(0, basicgame.load_Objects(2,544,0,100124));
instances.add(0, basicgame.load_Objects(2,528,0,100125));
instances.add(0, basicgame.load_Objects(2,512,0,100126));
instances.add(0, basicgame.load_Objects(2,496,0,100127));
instances.add(0, basicgame.load_Objects(2,480,0,100128));
instances.add(0, basicgame.load_Objects(2,464,0,100129));
instances.add(0, basicgame.load_Objects(2,448,0,100130));
instances.add(0, basicgame.load_Objects(2,432,0,100131));
instances.add(0, basicgame.load_Objects(2,416,0,100132));
instances.add(0, basicgame.load_Objects(2,400,0,100133));
instances.add(0, basicgame.load_Objects(2,384,0,100134));
instances.add(0, basicgame.load_Objects(2,368,0,100135));
instances.add(0, basicgame.load_Objects(2,336,0,100137));
instances.add(0, basicgame.load_Objects(2,320,0,100138));
instances.add(0, basicgame.load_Objects(2,352,0,100139));
instances.add(0, basicgame.load_Objects(2,304,0,100140));
instances.add(0, basicgame.load_Objects(2,288,0,100141));
instances.add(0, basicgame.load_Objects(2,272,0,100142));
instances.add(0, basicgame.load_Objects(2,256,0,100143));
instances.add(0, basicgame.load_Objects(2,240,0,100144));
instances.add(0, basicgame.load_Objects(2,224,0,100145));
instances.add(0, basicgame.load_Objects(2,208,0,100146));
instances.add(0, basicgame.load_Objects(2,192,0,100147));
instances.add(0, basicgame.load_Objects(2,176,0,100148));
instances.add(0, basicgame.load_Objects(2,160,0,100149));
instances.add(0, basicgame.load_Objects(2,144,0,100150));
instances.add(0, basicgame.load_Objects(2,128,0,100151));
instances.add(0, basicgame.load_Objects(1,48,432,100155));
instances.add(0, basicgame.load_Objects(1,592,432,100156));
instances.add(0, basicgame.load_Objects(1,592,48,100157));
instances.add(0, basicgame.load_Objects(3,16,448,100159));
instances.add(0, basicgame.load_Objects(3,608,448,100160));
instances.add(0, basicgame.load_Objects(3,608,16,100161));
instances.add(0, basicgame.load_Objects(3,80,80,100201));
instances.add(0, basicgame.load_Objects(3,80,384,100212));
instances.add(0, basicgame.load_Objects(9,16,16,100219));
instances.add(0, basicgame.load_Objects(4,80,80,100221));
instances.add(0, basicgame.load_Objects(5,64,384,100222));
instances.add(0, basicgame.load_Objects(6,544,384,100223));
instances.add(0, basicgame.load_Objects(7,544,80,100225));
instances.add(0, basicgame.load_Objects(10,32,16,100231));
instances.add(0, basicgame.load_Objects(3,112,320,100340));
instances.add(0, basicgame.load_Objects(3,64,240,100341));
instances.add(0, basicgame.load_Objects(3,160,224,100342));
instances.add(0, basicgame.load_Objects(3,272,368,100343));
instances.add(0, basicgame.load_Objects(3,144,416,100344));
instances.add(0, basicgame.load_Objects(3,224,304,100345));
instances.add(0, basicgame.load_Objects(3,288,176,100346));
instances.add(0, basicgame.load_Objects(3,144,144,100347));
instances.add(0, basicgame.load_Objects(3,256,80,100348));
instances.add(0, basicgame.load_Objects(3,176,48,100349));
instances.add(0, basicgame.load_Objects(3,448,160,100350));
instances.add(0, basicgame.load_Objects(3,432,352,100351));
instances.add(0, basicgame.load_Objects(3,384,256,100352));
instances.add(0, basicgame.load_Objects(3,544,288,100353));
instances.add(0, basicgame.load_Objects(3,400,416,100354));
instances.add(0, basicgame.load_Objects(3,384,80,100355));
instances.add(0, basicgame.load_Objects(3,560,160,100356));
instances.add(0, basicgame.load_Objects(3,496,240,100357));
instances.add(0, basicgame.load_Objects(3,544,416,100358));
instances.add(0, basicgame.load_Objects(3,32,384,100359));
instances.add(0, basicgame.load_Objects(3,32,96,100360));
instances.add(0, basicgame.load_Objects(3,80,16,100361));
instances.add(0, basicgame.load_Objects(3,64,160,100362));
instances.add(0, basicgame.load_Objects(3,368,160,100363));
instances.add(0, basicgame.load_Objects(3,496,32,100364));
instances.add(0, basicgame.load_Objects(3,320,320,100365));
instances.add(0, basicgame.load_Objects(0,48,48,100368));
instances.add(0, basicgame.load_Objects(2,0,16,100378));
instances.add(0, basicgame.load_Objects(2,0,80,100379));
instances.add(0, basicgame.load_Objects(2,0,64,100380));
instances.add(0, basicgame.load_Objects(2,0,48,100381));
instances.add(0, basicgame.load_Objects(2,0,32,100382));
instances.add(0, basicgame.load_Objects(3,288,256,100384));
instances.add(0, basicgame.load_Objects(8,304,224,100388));
instances.trimToSize();
roomsetup = 1;
SortDepth();
}
public synchronized void keyPressed(KeyEvent evt) {
int keycode = evt.getKeyCode();
// call key press events
if (keycode == 112) {
Game_Information mainFrame = new Game_Information();
mainFrame.setVisible( true );
}
ii = 0;
while (ii < (instances.size())) {
Objects o = (Objects)instances.get(ii);
o.Key_Pressed(keycode);
ii++;
}
}
public synchronized void keyReleased(KeyEvent evt) {
int keycode = evt.getKeyCode();
// call key Released events
ii = 0;
while (ii < (instances.size())) {
Objects o = (Objects)instances.get(ii);
o.Key_Released(keycode);
ii++;
}
}
public synchronized void keyTyped(KeyEvent evt) {
}
public void mouseClicked(MouseEvent evt) {
}
public void mouseEntered(MouseEvent evt) {
// called when the pointer enters the room's rectangular area
}
public void mouseExited(MouseEvent evt) {
// called when the pointer leaves the room's rectangular area
}
public void mousePressed(MouseEvent evt) {
int keycode = evt.getButton();
// call mouse press events
ii = 0;
while (ii < (instances.size())) {
Objects o = (Objects)instances.get(ii);
o.mouse_Pressed(keycode,evt.getX(),evt.getY());
ii++;
}
}
public void mouseReleased(MouseEvent evt) {
}
public void paint(Graphics g) {
// The main game loop
Font f = new Font("Arial Narrow",Font.PLAIN,16);
g.setFont(f);
// Clear the drawing buffer to the background color
g.setColor( backcolor );
g.fillRect( 0, 0, ScreenWidth, ScreenHeight );
// draw backgrounds
//Scroll this background
Xc0 = Xc0 + hspeed0;
Yc0 = Yc0 + vspeed0;
//check if it has moved more than the size
if (Xc0 > basicgame.background[0].back_width + Xpos0)
Xc0 = Xpos0;
if (Yc0 > basicgame.background[0].back_height + Ypos0)
Yc0 = Ypos0;
if (basicgame.Runningas != "EApplet") {
NumberX = 1 + ((int)R.getWidth()+Xpos0)/ basicgame.background[0].back_width;
NumberY = 1 + ((int)R.getHeight()+Ypos0) / basicgame.background[0].back_height;
} else {
NumberX = 1 + ((int)basicgame.Eapplet.getWidth()+Xpos0)/ basicgame.background[0].back_width;
NumberY = 1 + ((int)basicgame.Eapplet.getHeight()+Ypos0) / basicgame.background[0].back_height;
}
for (int i = 0;i <= NumberY; i++)
{
for (int j = 0;j <= NumberX; j++)
{
g.drawImage(basicgame.background[0].show(), j*basicgame.background[0].back_width + Xc0, i*basicgame.background[0].back_height + Yc0, basicgame.background[0].back_width, basicgame.background[0].back_height, this);
}
}
dd = 0;
while (dd < instances.size()) {
this.instance_id = dd;
Objects o = (Objects)instances.get(dd);
o.Begin_Step_event();
o.Alarm();
o.Keyboard_event();
o.Step();
if((o.X <= -1) || (o.X >= basicgame.Current_room.Width+1) || (o.Y <= -1) || (o.Y >= basicgame.Current_room.Height+1)) {
o.Outside();
}
o.Move();
o.Collision_event();
o.End_Step_event();
// decrease the alarms
o.decrease_alarms();
dd = this.instance_id;
dd++;
}
dd = 0;
while (dd < depth.size() ) {
tile t = (tile)depth.get(dd);
t.Draw_event(g);
dd++;
}
dd = 0;
}
}
class rm_Menu extends RoomPanel implements KeyListener,MouseListener {
public Objects o;
public int roomsetup=0;
private int ii, dd;
JFrame R;
public static Vector backgrounds = new Vector();
rm_Menu (JFrame R, int id,int roomid) {
super(R, "Choose", 30, 640, 480, new Color(192,192,192));
this.R = R;
this.id = id;
this.roomid = roomid;
if (basicgame.Runningas != "EApplet") {
R.addKeyListener(this);
R.addMouseListener(this);
} else {
basicgame.Eapplet.addKeyListener(this);
basicgame.Eapplet.addMouseListener(this);
}
}
public void setup_Room() {
//setup variables
hspeed0 = 0;
hspeed1 = 0;
hspeed2 = 0;
hspeed3 = 0;
hspeed4 = 0;
hspeed5 = 0;
hspeed6 = 0;
hspeed7 = 0;
vspeed0 = 0;
vspeed1 = 0;
vspeed2 = 0;
vspeed3 = 0;
vspeed4 = 0;
vspeed5 = 0;
vspeed6 = 0;
vspeed7 = 0;
Xpos0 = 0 - basicgame.background[1].back_width;
Xpos1 = 0;
Xpos2 = 0;
Xpos3 = 0;
Xpos4 = 0;
Xpos5 = 0;
Xpos6 = 0;
Xpos7 = 0;
Ypos0 = 0 - basicgame.background[1].back_height;
Ypos1 = 0;
Ypos2 = 0;
Ypos3 = 0;
Ypos4 = 0;
Ypos5 = 0;
Ypos6 = 0;
Ypos7 = 0;
// create all the objects backgrounds tiles etc
// vector of instances
instances = new Vector(6);
instances.add(0, basicgame.load_Objects(16,260,240,100238));
instances.add(0, basicgame.load_Objects(13,288,208,100235));
instances.add(0, basicgame.load_Objects(12,288,176,100234));
instances.add(0, basicgame.load_Objects(14,16,16,100236));
instances.add(0, basicgame.load_Objects(11,160,0,100233));
instances.add(0, basicgame.load_Objects(18,72,64,100366));
instances.trimToSize();
roomsetup = 1;
SortDepth();
}
public synchronized void keyPressed(KeyEvent evt) {
int keycode = evt.getKeyCode();
// call key press events
if (keycode == 112) {
Game_Information mainFrame = new Game_Information();
mainFrame.setVisible( true );
}
ii = 0;
while (ii < (instances.size())) {
Objects o = (Objects)instances.get(ii);
o.Key_Pressed(keycode);
ii++;
}
}
public synchronized void keyReleased(KeyEvent evt) {
int keycode = evt.getKeyCode();
// call key Released events
ii = 0;
while (ii < (instances.size())) {
Objects o = (Objects)instances.get(ii);
o.Key_Released(keycode);
ii++;
}
}
public synchronized void keyTyped(KeyEvent evt) {
}
public void mouseClicked(MouseEvent evt) {
}
public void mouseEntered(MouseEvent evt) {
// called when the pointer enters the room's rectangular area
}
public void mouseExited(MouseEvent evt) {
// called when the pointer leaves the room's rectangular area
}
public void mousePressed(MouseEvent evt) {
int keycode = evt.getButton();
// call mouse press events
ii = 0;
while (ii < (instances.size())) {
Objects o = (Objects)instances.get(ii);
o.mouse_Pressed(keycode,evt.getX(),evt.getY());
ii++;
}
}
public void mouseReleased(MouseEvent evt) {
}
public void paint(Graphics g) {
// The main game loop
Font f = new Font("Arial Narrow",Font.PLAIN,16);
g.setFont(f);
// Clear the drawing buffer to the background color
g.setColor( backcolor );
g.fillRect( 0, 0, ScreenWidth, ScreenHeight );
// draw backgrounds
//Scroll this background
Xc0 = Xc0 + hspeed0;
Yc0 = Yc0 + vspeed0;
//check if it has moved more than the size
if (Xc0 > basicgame.background[0].back_width + Xpos0)
Xc0 = Xpos0;
if (Yc0 > basicgame.background[0].back_height + Ypos0)
Yc0 = Ypos0;
if (basicgame.Runningas != "EApplet") {
NumberX = 1 + ((int)R.getWidth()+Xpos0)/ basicgame.background[1].back_width;
NumberY = 1 + ((int)R.getHeight()+Ypos0) / basicgame.background[1].back_height;
} else {
NumberX = 1 + ((int)basicgame.Eapplet.getWidth()+Xpos0)/ basicgame.background[1].back_width;
NumberY = 1 + ((int)basicgame.Eapplet.getHeight()+Ypos0) / basicgame.background[1].back_height;
}
for (int i = 0;i <= NumberY; i++)
{
for (int j = 0;j <= NumberX; j++)
{
g.drawImage(basicgame.background[1].show(), j*basicgame.background[1].back_width + Xc0, i*basicgame.background[1].back_height + Yc0, basicgame.background[1].back_width, basicgame.background[1].back_height, this);
}
}
dd = 0;
while (dd < instances.size()) {
this.instance_id = dd;
Objects o = (Objects)instances.get(dd);
o.Begin_Step_event();
o.Alarm();
o.Keyboard_event();
o.Step();
if((o.X <= -1) || (o.X >= basicgame.Current_room.Width+1) || (o.Y <= -1) || (o.Y >= basicgame.Current_room.Height+1)) {
o.Outside();
}
o.Move();
o.Collision_event();
o.End_Step_event();
// decrease the alarms
o.decrease_alarms();
dd = this.instance_id;
dd++;
}
dd = 0;
while (dd < depth.size() ) {
tile t = (tile)depth.get(dd);
t.Draw_event(g);
dd++;
}
dd = 0;
}
}
class load_Rooms {
public static JFrame Room;
public static int firstroom = 1;
public static int lastroom = 0;
public static JApplet maingamep;
public static RoomPanel[] rooms = new RoomPanel[2];
public static int roomid;
public static Image GIcon;
public static int getroom[]= {1,0};
load_Rooms(int roomid) {
JFrame room = new Room(332,92,true, Color.black);
if (basicgame.Runningas == "Application") {
StartPanel.loadingframe.dispose();
}
GIcon = new ImageIcon(getClass().getResource("icon.png") ).getImage();
room.setIconImage(GIcon);
room.show(true);
this.Room = room;
this.roomid = roomid;
change_room(roomid);
}
load_Rooms(int roomid,JApplet maingamep) {
//it is embedded
this.maingamep = maingamep;
change_room(roomid,maingamep);
}
public static boolean if_prev_room(int roomid) {
if (roomid == firstroom) { return false; } else { return true; }
}
public static boolean if_next_room(int roomid) {
if (roomid == lastroom) { return false; } else { return true; }
}
public static void prev_room(int roomid,JApplet maingamep) {
int gjavai = 0;
while (gjavai < getroom.length) {
if (getroom[gjavai] == roomid) { change_room(getroom[gjavai-1],maingamep); } gjavai++;
}
}
public static void prev_room(int roomid) {
int gjavai = 0;
while (gjavai < getroom.length) {
if (getroom[gjavai] == roomid) { change_room(getroom[gjavai-1]); } gjavai++;
}
}
public static void restart_room(int roomid,JApplet maingamep) {
int locali = basicgame.Current_room.roomid;
remove_room(basicgame.Current_room.id);
change_room(locali,maingamep);
}
public static void restart_room(int roomid) {
int locali = basicgame.Current_room.roomid;
remove_room(basicgame.Current_room.id);
change_room(locali);
}
public static void next_room(int roomid,JApplet maingamep) {
int gjavai = 0;
while (gjavai < getroom.length) {
if (getroom[gjavai] == roomid) { change_room(getroom[gjavai+1],maingamep); } gjavai++;
}
}
public static void next_room(int roomid) {
int gjavai = 0;
while (gjavai < getroom.length) {
if (getroom[gjavai] == roomid) { change_room(getroom[gjavai+1]); } gjavai++;
}
}
public static void change_room(int roomid,JApplet maingamep) {
if (roomid == 1) {
rooms[0] = new rm_Menu(Room,0,roomid);
basicgame.Current_room = rooms[0];
maingamep.getContentPane().add( rooms[0]);
}
if (roomid == 0) {
rooms[1] = new rm_Avoidy(Room,1,roomid);
basicgame.Current_room = rooms[1];
maingamep.getContentPane().add( rooms[1]);
}
}
public static void remove_room(int roomid) {
basicgame.close_sounds();
if (basicgame.Runningas != "EApplet") {
Room.removeKeyListener((KeyListener)rooms[roomid]);
Room.removeMouseListener((MouseListener)rooms[roomid]);
Room.remove(rooms[roomid]);
} else {
// remove from embeded applet
maingamep.removeKeyListener((KeyListener)rooms[roomid]);
maingamep.removeMouseListener((MouseListener)rooms[roomid]);
maingamep.remove(rooms[roomid]);
}
}
public static void change_room(int roomid) {
if (roomid == 1) {
rooms[0] = new rm_Menu(Room,0,roomid);
basicgame.Current_room = rooms[0];
Room.setSize(rooms[0].Width,rooms[0].Height);
Room.getContentPane().add( rooms[0]);
Room.validate();
}
if (roomid == 0) {
rooms[1] = new rm_Avoidy(Room,1,roomid);
basicgame.Current_room = rooms[1];
Room.setSize(rooms[1].Width,rooms[1].Height);
Room.getContentPane().add( rooms[1]);
Room.validate();
}
}
}