Hello, i'm a beginner with AGD and i'm still assimilating all video tutorials, but i'd like to know if it's possible to spawn random enemies as seen in many Ultimate games (like Atic Atac or Sabre Wulf); in particular it could be interesting to have:
- two or three randomly-generated enemy sprites after a given delay;
- apply a smoke sprite before the sprite enemy comes to life;
- extend the respawn delay after all enemies are killed.
I think that could be a very challenging code, but if we want to create an exploring game, leaving the Manic Miner platforms, it could be very very useful!
Last Edit: Dec 2, 2013 19:54:30 GMT -5 by lukebord1
firstly I would say look at Tea and Sympathy as an example for spawning sprites (it's in the main loop 1 event)
I would think about the layout of the background for each screen of the map, decide if you want the sprites to appear in a static position or at a random position.
with regards to spawning you could set up a blank sprite and and have the event(s) for this sprite do something like this:-
set a random number to act as a count down, I'd use parama or paramb as the variable as it will be unique to the sprite rather than a universal one
change the image from the blank to smoke
once the smoke has animated for a set number of times (use parama or paramb to count down), randomly choose an enemy image and a sprite type (ie one could be bouncing, another could patrol back and forth or even head towards the player)
if it dies, change the animation to a death animation, once that has completed change back to the blank image and the event the holds the countdown to start the process all over again
if your spawning point is static then the layout of the backgrounds does not matter as you'll position the spawn point using the 'sprite position' in the menu
if you want to spawn randomly then you need to have an area clear of blocks which is the same on each screen so you don't get an enemy spawning in the background, remember that random numbers are generated from 0 to whatever you choose so if you have blocks around the edge of the screen you will have to add (in multiples of 8) to the x and y position of the sprite to miss them
GETRANDOM 128 LET X = RND ADD 8 TO X...(or 16 etc depending on how many blocks are at the edge)
now if you don't want to have the same clear area on each screen (like in sabre wulf) but still want enemies to spawn in a random position you could place the sprite in a static position (using sprite positions in the menu) and then have the blank sprite scripted to move around the screen until the timer has lapsed and it then becomes enemy and tehn when it dies you can revert it to the blank sprite again which will move around again until timer reaches zero and changes to an enemy.