Post by alessandro on Oct 11, 2018 15:25:51 GMT -5
I did it in a very simple way.
First of all, you need to set the points in the map where your objects will spawn before the start of each game. Write down the screen number and X/Y coordinates for each spawning point.
Then set a random value variable as a condition to spawn the objects in the Game Initialization event and assign each position according to that variable. If your variable is A, for instance, begin with:
IF A = 0 LET SCREEN 0 LET X 128 LET Y 44 PUT 0 LET SCREEN 2 LET X 64 LET Y 88 LET SCREEN 5 ... ENDIF IF A = 1 LET SCREEN 4 LET X 64 LET Y 32 PUT 0 LET SCREEN 8 LET X 24 LET Y 80 PUT 1 ... ENDIF and so on.
To save memory you can arrange the LET X, Y etc. commands so that, if a coordinate repeats itself, you can omit it. E.g. instead of:
LET SCREEN 1 LET X 128 LET Y 64 PUT 1 LET SCREEN 3 LET X 128 LET Y 96 PUT 2 you can do this:
LET SCREEN 1 LET X 128 LET Y 64 PUT 1 LET SCREEN 3 LET Y 96 PUT 2 On a side note, I did not use the RND function of AGD for this task, because it seems, especially when playing under emulation, to return the same sequence of values most of the times. I employ a very simple Assembly code snippet, derived from a short program developed by John Connolly:
LD A,R ; loads R register into the accumulator AND %00000011 ; masking to let the result always be 0, 1, 2 or 3 LD (32029),A ; AGD's A variable (located at address 32029) is loaded with the accumulator's value RET which is then recalled in the Game initialization event with the usual ASM commands.
Games where I employed this method: Apulija-13 (latest version), Seto Taisho To Kazan, Sophia and Doom Pit.
Last Edit: Oct 11, 2018 15:27:23 GMT -5 by alessandro