Return to previous page Return to menu Go to next page

Action control usage example

Actual usage example of action.

/*
 *    Variable definition
 */
Uint8  Mainlevel;
Uint8  Gameover;
SMTA_DefActWk(GAMEACT,
    SPRITE sprite; / * SPRITE DISPLAY * /
    Sint16 wreg [4]; / ​​* General-purpose register * /
    Sint16 wcnt [4]; / ​​* General-purpose counter * /
    Uit8 colino; / * collision table index * /
    Uint8 coliatr; / * collision attribute * /
    Uint8 coliflg; / * collision flag * /
    Uint8 atp; / * kougeki ryoku * /
    Sint16 hp; / * hit point * /
); / * Declare dedicated action structure GAMEACT * /
/*
 * Function prototype
 */
void GameMain(void);
void PlayerAct(GAMEACT *);
void EnemyAct(GAMEACT *);
void ScrollAct(GAMEACT *);
/ * #### [Example of action main part] #### * /
void GameMain(void)
{
    enum {
        INIT, MAIN,
    };
    Mainlevel = INIT;
    Gameover = 0; / * Game end flag * /
    for(;;) {
        intWait (); / * Waiting for V blank * /
        switch(Mainlevel) {
        case INIT:
            InitVdp (); / * VDP initialization * /
            SMTA_ActWkInit (); / * Action work initialization * /
            SMTA_MakeAction(PlayerAct);
                                       / * Player action set * /
            SMTA_MakeAction(EnemyAct);
                                       / * Enemy action set * /
            SMTA_MakeAction(ScrollAct);
                                       / * Background action set * /
            Mainlevel++;
        case MAIN:
            SMTA_ActionLoop();
            if (Gameover) Mainlevel++;
            break;
        case EXIT:
            return; / * End of game * /
        }
    }
} 


Return to previous page Return to menu Go to next page