I’m trying to create a side scrolling shoot 'em up type game and I’m having trouble spawning the enemies, this is my code right now.
if (r==1 && enemy==true)
if (buggieY>600 || buggieY<0)
if (x>725 && x<775 && y>buggieY-50 && y<buggieY+50)
I’m newer to processing so any help would be nice,
You need functions triggered by some event like mousePressed() and of course the special Processing void draw() function. This function will be called by an internal timer and will run at a frame rate of about 60 times per second, looping your code. Without that it will run your code just once .
I guess you have setup and draw and you posted only the relevant part of your code.
When you want to have multiple enemies shown at the same type, make an array or arraylist of them.
When only one enemy is visible at a time, you can respawn it by placing it to the very right. I think you do this with
You can also use a random here:
enemyX=int(random(width+22, width + 130));
So don’t say
enemy=false; and instead just place the enemy on the far right.
Welcome to the forum!
Thanks for the help and for the welcome, hope you gave a great day!