-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLauncher.java
More file actions
106 lines (94 loc) · 6.51 KB
/
Launcher.java
File metadata and controls
106 lines (94 loc) · 6.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import greenfoot.*;
/**
* Launcher which introduces the background information and key bindings of the game to player.
*
* @author Xuanxi Jiang
* @version 1.0
*/
/*
Acknowledgement:
My Teacher: Partial concepts (“speed, friendly(boolean)” variables for bullets, getStringWidth() method).
P.S. I have optimized the getStringWidth() method via binary search to increase its efficientcy, so technically it is not
simple copy&past. However, the same concept is used.
ZUN (Jun'ya Ota): Game background music (Nuclear_Fusion.wav)
GAME FREAK: Game launcher and endings background musics (Wigglytuff's Guild.wav, Don't_Ever_Forget.wav, N's_Castle.wav)
* Due to copyright reasons, the listed background music will not be included in this repo.
Developers of “LuaSTG-EX-Plus” (https://github.com/Xiliusha/LuaSTG-EX-Plus): All game sound effects, game mechanics inspiration.
Developers of Greenfoot: design of "ice.jpg", game IDE & runtime
Adobe Stock: Background Image for the two endings (edited via GIMP to synthesize the needed background image; however, the base
background image is from Adobe Stock. Upscaled using BSRGAN model)
All other assets and methods used in this game are developed & designed by me.
Notes:
All background musics were named as its original name to acknowledge the original author.
This peice of information is also provided in the "Scenario information".
Game introduction:
This game is a vertical STG (or shooting game) which the player is required to dodge projectiles generated by the enemy
while producing damage to the enemy. Further background story settings will be provided in the “Launcher” world.
Projectiles launched by enemy will not cause any damage unless it hits the “hit square” of player, which is located in the
centre of the player; however, the enemy could be damaged by projectiles launched by the player as long as the projectile hits
the image of enemy. The player has 3 lives (or “shields”) and will die immediately when hit by enemy if all shields are lost
Cheat instruction:
remove the last line of code ("inCntDown--") in move() method of STGPlayer_Normal enables you to cheat and stay in invincible
state after dying once.
Character movement:
User could manipulate the “player” object by using arrow keys. The “z” key is used to launch projectiles when pressed,
and the “shift” key is used to make the "player" object move slower. The projectiles launched by player will
automatically aim to the enemy if the player is not pressing shift and will aim to the front if shift is pressed. However,
the damage of projectiles varies as the movement speed of player – projectiles launched in low movement speed mode could cause
greater damage than high movement speed mode.
Enemy attacks:
The Enemy is capable of launching two main types of projectiles: normal projectiles and laser attack. Neither projectile
type could consistently aim to player. Laser attacks will have a warning sign (laser line) before launched to inform the player
to dodge, and normal projectiles are designed so that the player will always have enough space and reaction speed to dodge.
Endings:
There are two types of endings: good-end and bad-end. Good-end appears when the player is successful in defeating the enemy
in all three states, and bad-end appears when the player has 0 “shield” remaining and represents the failure of player.
*/
public class Launcher extends World{
private int Curpanel, maxPanel, cnt;
//private final GreenfootSound Launcher_BGM = new GreenfootSound("Wigglytuff's Guild.wav");;
private final GreenfootImage Launcher_Background = new GreenfootImage("Launcher.png");
private final String[] text = {"The Pokemon world is under invasion of a black light orb from outside of universe exuding dangerous corruption! The light orb was absorbing and corrupting the energy pathways of the world, and the corruption would extent to every single atom as soon as all energy pathways were corrupted, causing the entire world to become mindless puppets of the light orb.",
"The light orb could generate powerful bullets capable of defeating any known pokemon at instance, and is invincible to all pokemon moves in existence. The only hope for this world is someone being brave enough to accept the evil forces of the light orb and use it as a weapon to defend the world… As the bravest eevee in Treasure Town, you decided to take the risk!",
"After absorbing the energy and mixing it with the pokemon power in your body, you found that you gained the ability to fly and shoot bullets which could damage the orb. After a long journey, you finally found the orb somewhere near the north pole. \nAn epic battle is on the verge!",
"Operation Guide: \nUse arrow keys to move; \nHold [shift] key to move slower and to show your hit-box; \nHold [z] key to shoot bullets; \nYou will only be considered hit if your hit-box is hit. \nGood luck!"};
public Launcher(){//Initialize neccecarry stuff
super(Engine.worldWidth, Engine.worldHeight, 1);
Engine.WorldState = 2;
Greenfoot.setSpeed(50);
Curpanel = 1; maxPanel = text.length; cnt = 0;
this.setBackground(draw());
}
public void act(){
if(cnt>0)
cnt--;
if(Greenfoot.isKeyDown("enter")){//If enter is pressed, go to STG stage.
Greenfoot.setWorld(new STGStage_1());
//Launcher_BGM.stop();
}else if (Greenfoot.isKeyDown("right")){//lazy loading the background
if(Curpanel<maxPanel && cnt == 0){
Curpanel++;
this.setBackground(draw());
}
cnt = 2;//add delay before next detection to prevent user from continuously switching panels.
}else if (Greenfoot.isKeyDown("left")){//similar to the case when "right" is down.
if(Curpanel>1 && cnt == 0){
Curpanel--;
this.setBackground(draw());
}
cnt = 2;
}
}
public void started(){//Play BGM when started.
//Launcher_BGM.playLoop();
}
private GreenfootImage draw(){
GreenfootImage tmp = new GreenfootImage(Launcher_Background);
tmp.setFont(new Font("Helvetica", 52));
tmp.drawString(Curpanel+" / "+maxPanel, 1210, 445);
tmp.setFont(new Font("Helvetica", 24));
String out = Engine.wordWrap(text[Curpanel-1], new Font("Helvetica", 24), 630);
tmp.drawString(out, 488, 230);//draw the output string
return tmp;
}
}