Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Final_diplom.docx
Скачиваний:
0
Добавлен:
01.07.2025
Размер:
14 Мб
Скачать
☆

Figure 3.17 - Diagram Databases

Description of the classes

GameController.as – is a main class, which connect with other classes.

Table 3.1 - Shown functions of this class

Function

Type

Description

turnOffPlacing()

MouseEvent

currentLabel == "on"

showTowerFireHelp()

Checking, updating and stops the game

turnOnPlacing()

MouseEvent

currentLabel == "possible"

spawnMonster()

push(monsterToSpawn);

This function add my enemy

gameOver()

RemoveEventListener

Play again

spawnWave()

C.BOSS_START_X - 40*i;

This function write counts of my enemy waves

clickTowerFire()

MouseEvent

Check if the player has already clicked on a tower, create a Fire Tower, turn on all placings

startMenu()

btnPlay

This variable of type button, if pressed starts the game

startGameWin()

btnRestart

This variable of type button, if pressed game restarted

setupGame()

getChildAt(i);

To create a new currObject, which is Placing

Xml files

Extensible Markup Language (XML) is a markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. In diploma project xml used for designing application. XML is view of application for user. In table 3.3.2 xml’s used in diploma project.

Gallery.xml:

Table 3.2 – Xml description

Name

Type

Description

IMAGE FULL

full_images

In this folder my big images

THUMB

Thumbs

In this folder my small images

Preloader.as – this class is preloader of my game, which counts size of my project (6764 kb).

Table 3.3 - Shown preloader class’s functions

Function

Type

Description

preloader()

addEventListener

Create Update funtion

Update ()

Event

This function consists of mathematical logics and loadings strings.

Register.swf:

This file is used for login (logout) and registration before the starting the game, which connected with php files:

login.sendAndLoad("http://localhost/flaphpsql/data/login.php", logged, "GET");

register.sendAndLoad("http://localhost/flaphpsql/data/register.php", registered, "GET");

PHP scripts:

login.php:

<?php

require_once('../include/dbconnect.php');

$user = $_GET['user'];

$pass = $_GET['pass'];

$result = mysql_query("SELECT * FROM accounts WHERE user = '$user' AND pass = '$pass'");

if(mysql_num_rows($result)==0){

$login = "&err = Login Failed.";

echo($login);}

else{$row = mysql_fetch_array($result);

$user=$row['user'];

$pass=$row['pass'];

$login = "&user=" . $user . "&pass=" . $pass . "&err=Login Successful.";

echo($login);}?>

register.php:

<?php

require_once('../include/dbconnect.php');

$user = $_GET['user'];

$pass = $_GET['pass'];

$result = mysql_query("SELECT * FROM accounts WHERE user = '$user'");

if(mysql_num_rows($result)>0){

$register = "&err = Registration Failed.";

echo($register);}

else{

mysql_query("INSERT INTO accounts (id,user,pass) VALUES ('', '$user', '$pass')");

$register = "&err=Registration Successful.";

echo($register);}?>

dbconnect.php:

<?php

define("HOST", "localhost");

define("DBUSER", "root");

define("PASS", "");

define("DB", "cora_db");

$conn = mysql_connect(HOST, DBUSER, PASS) or die ('Could not connect to server.');

$db = mysql_select_db(DB) or die('Database could not be located.');?>

C.as – is initialize general, game, towers, monsters and bullets constants.

For example: public static const TOWER_FIRE_COST:Number = 60;

Bullet.as – is class of bullets in my game.

Table 3.4 - shown bullet class’s functions

Function

Type

Description

Bullet ()

This

Create new variables

update ()

hitTestPoint

This function consists of mathematical logics of Slow Effect to monster and damage all nearby monsters

Boss.as – is class where written coordinates, speed and life of my enemy-boss.

Table 3.5 - Shown Boss class’s functions

Function

Type

Description

Boss ()

checkPoints

Create new variables and coordinate my boss

takeDamage

gotoAndPlay("death");

Counts damage

update ()

Var

finalSpeed

Tower_Fire.as – is tower class in my game.

Table 3.6 - Shown Tower_Fire class’s functions

Function

Type

Description

Tower_Fire ()

Number

Initialize variables

setActive()

Boolean

true

update ()

Var

spawn new bullet

Placing.as – is used for checking of some placed objects.

Table 3.7 - Shown Placing class’s functions

Function

Type

Description

Placing ()

Boolean

true

placeTower ()

Boolean

canPlace = false;

Monster.as - is class where written 1coordinates, speed and life of my enemies.

Table 3.8 - Shown Monster class’s functions

Function

Type

Description

Monster ()

checkPoints

Create new variables and coordinate my enemies

takeDamage

gotoAndPlay("death");

Counts damage

update ()

var

move in the direction of the checkpoint

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]