Start creating structures of game and some tests which I want to know


I'm start thinking about structures for my game. For example, the game state. It contains state which is "in the title" or "in the stage 1" or "in the game over and wait continue" or something like that. Also, it contains time, high score, etc. Also I need player character related related structure, enemy related, missile related.

During thinking those structures, I want/need to know some technique below.

  • Time count 
  • Read const data table
  • Function if blitz has it
  • Multiple source file

Time count 

I'm thinking how to decide it's time to show this enemy. I want to use data table that has info at least "when" and "what". For example, "10 secs later after stage start, start showing enemy #12". I need to know what time is it now from stage start. To do that, I would use interrupt every v-blank to counting up time counter. So that I can see seconds or frames (*15.6ms if NTSC system).  After that, I am keeping on eyes to the table and current time counter to show new enemy in the loop. Tried this test  code (picture 1) and looks good! I feel this is very common (or just I don't know better way) demand. I'm not surprise if blitz has this kind of counter. But since I could not find it so far. I would use this way until I find it.

Read const data table

Blitz has Data command for this purpose. I need at least 2 datas for 1 enemy character (may be more). For example, when(seconds from stage start) and which enemy (type# of enemy).

Data 10,1, 12, 2, ...

This means 10 secs after stage start, start showing enemy#1, 12 secs after stage start, start showing enemy#2, ...

Maybe I need to roll back to some place, when the player character die. Blitz can do that to use restore command. I feel I don't need to store those datas into array once. I can read same data multiple time with restore command. Sounds good.

Function

I tried Function which return value and Statement which doesn't return any value. Also used global value inside of function. I think, for example, game state will be global value, I want to access from function. In this case, game state is not a primitive type. In other words, it is NEWTYPE. I verified it can access from function as well.

Function TestFunc{fa}
    SHARED f.MyStruct
    NPrint f\data
     Function Return 0
End Function

Multiple Source File

I'm planning to separate source files. For example, definition of structures, data tables, enemy behavior calculate functions, main loop, title loop, game over loop, stage loop. So that I will be able to find source place easily when debugging. I tested include command.

But during this experiment, I notice that I need to load main source to compile and run after I made some change in sub source file. That's slow down coding & testing. Maybe possible to open multiple file and change source & compile super-fast or do compile & run via command line. But I don't know so far. This is todo list for now.

Get My First Shooting Game For Amiga

Leave a comment

Log in with itch.io to leave a comment.