Base Enemy Generator

Heres a snazzy little code snippit that generatest enemies in a game that I’ve working on.  I’ll need to build a lot more functionality into it eventuially, but its great for the proof of concept phase.

//if timer = 0
if enemy_count <= 0{
//create an enemy
instance_create(random(room_width),0,obj_enemy)
//find a new time
enemy_count = irandom(enemy_count_max)}
//decrament timer
enemy_count -= 1

I know its not that exiting, but I figured I was long overdue on posting.

Also, I’ve made a cool terrain generator.  I line up a bunch of terrain generator objects across the top of the screen then load geographic stuff like lakes into thier ques.

//if no ground is meeting the generater, generate ground from ground_que list
if not place_meeting(x,y,obj_ground){
//create the instance in the 1 spot of the que
instance_create(x,y,ds_stack_pop(que))
//if stack is empty, add a grass
if ds_stack_empty(que){
ds_stack_push(que,obj_grass)}}

 

In theory i should be able to generate a random 2d array by parameters that form things like lakes or rivers then use that array to load up my stacks for each geography generator.  Sadly, i’ve only had enough time to make it generat grass tonight, i’ll have to try building some geography to load up this weekend!

 

This is juat a novelty project, but I’d like to see it turn into my next game release, I’m loving working on it so far!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s