Tečaj
:: Predavatelj: Žiga Hajduković. e-mail. .
:: Organizator: Dane Šoba. e-mail. Študentska organizacija FRI (ŠOFRI).
:: Domača stran tečaja: www.tetris1d.org/game/dev/tecaj/.
:: game/dev.si forum: www.tetris1d.org/game/dev/forum_si/.
:: Študentski info sistem FRI: http://www.student-info.net/fri/.
Čestitam vsem sodelujočim v velikem nagradnem tekmovanju za najboljšo mobilno igro, ki jo je sponzoriralo priznano podjetje Cocoasoft!
V zelo kratkem času vam je uspelo prekositi same sebe in ustvariti igre, ki so presegle vsa pričakovanja!
Objavili smo galerijo vseh sodelujočih iger, kjer si lahko ogledate posnetke akcije iz samih iger, pa tudi fotografije iz podelitve bogatih nagrad!
Ne pozabite na gd.si forum, kjer si bomo še naprej izmenjevali mnenja in pomagali drug drugemu na poti k izdelovanju najboljših mobilnih iger!
Lekcija 02 |
lekcija 01 :: domov :: lekcija 03 |
Epsilon 01 eclipse workspace project (sfx)
Odpri povezavo:
http://www.tetris1d.org/gdwap/na svojem mobilnem telefonu in si naloži Epsilon_01.
GameCanvas.java (izvorna datoteka)
GameSprite.java (izvorna datoteka)
// some variables and constants public static byte mode; public static final byte MODE_INTRO = 0; public static final byte MODE_GAME = 1; public static final byte MODE_MENU = 2; public static Image imgIntro; public static Image imgBackground; public static Image imgPlayer; public static Image imgPlayerFire; public static Image imgEnemy; public static int menuScreen; public static final byte MENU_SCR_MAIN = 0; public static final byte MENU_SCR_TEXT_ABOUT = 1; public static final byte MENU_SCR_TEXT_HELP = 2; public static final byte MENU_SCR_TEXT_GAME_OVER = 3; public static GameSprite player; public static GameSprite player_fire; public static Vector enemySprites;
public static Random random = new Random();
GameCanvas(Game midlet)
{
// init
}
public void run()
{
while(gameRunning)
{
repaint();
serviceRepaints();
switch (mode) {
case MODE_INTRO:
// load the intro and other images ...
case MODE_MENU:
// switch menu options on command_up/down
// switch menu screens on select command
// exit on softkey 2 in main menu
case MODE_GAME:
// update space background
// update enemy sprites
// update player sprite
// update player fire sprite
// check player <-> enemy <-> player fire collision
// check for game end conditions (player.energy == 0? softkey 2 pressed)
}
}
}
public void paint(Graphics g)
{
switch(mode)
{
case MODE_INTRO:
// paint intro splash image
case MODE_MENU:
// paint space background
// paint the active Menu Screen
// + Main Menu options list OR
// + one of the text menu screens (About, Help, Game Over ..)
case MODE_GAME:
// paint scrolling space background
// paint player sprite
// paint player fire sprite
// paint enemy sprites
// paint status bars
}
}
public void keyPressed(int key)
{
// check for softkey 1 or 2 keycode
// set flags for UP, DOWN, LEFT, RIGHT and FIRE game actions
}
public void keyReleased(int key)
{
// unset flags for UP, DOWN, LEFT, RIGHT and FIRE game actions
}
public void paintSpaceBackground(Graphics g)
{
// fill the vast space
// tile a scrolling background image vertically
}
public void paintMainMenu(Graphics g)
{
// paint main menu options, highlight the selected option
// paint softkey command menu
}
public void paintTextMenu(Graphics g, int screen)
{
// paint menu screen text lines
// paint score, if screen == game over screen
// paint softkey label
}
public static void paintSprite(Graphics g, GameSprite spr)
{
// paint the sprites image at its coordinates
}
public static void paintStatusBars(Graphics g)
{
// paint the energy bar
// paint the score count
}
public void startGame()
{
// switch to game mode
// initialize player sprite
// intialize the scrolling background
// initialize the enemy sprites list
}
public void endGame()
{
// back to menu mode, set the game over text screen
// clean up
}
public void updateEnemySprites()
{
// check if a new enemy has to be generated
// if yes, create a new enemy
// and add it to the enemy sprites list
// move enemy sprites
// if enemy is out of screen
// remove it from the enemy sprites list
}
public void updatePlayerSprite()
{
// move player sprite on command, and check player <-> screen edge collision
// start player fire on FIRE action
}
public void doCollision()
{
// check player <-> enemy collision
// player loses energy
// enemy sprite is destroyed
// check player fire <-> enemy collision
// destroy player fire
// enemy sprite is destroyed
// increase player score
}
public void updatePlayerFireSprite()
{
// move player fire
// destroy player fire when out of screen
}
}
Epsilon 01, dodatna grafika (by geci)
Grafika za igro Axion Space, Cocoasoft
| game/dev.si | :: predlogi ? pišite: Žiga Hajduković |