Space Invaders - shooting bombs

harrie88's icon

Hey guys,

I've been working on a space invaders like game,
as usual, you move horizontally and click to fire at the enemy.
The enemies are coming down on you slow.

But as you can see my cannon won't release the bombs, probably because i used a receive object..

Max Patch
Copy patch and select New From Clipboard in Max.

I can't get it figured out, so if anyone would be so kind to look into it, I would very much appreciate it! :)

do.while's icon

sorry i cant help you . but i appreciate your effort so far :) crossing fingers

harrie88's icon

The recieve "r xas" in the patch called "shoot" has two lines to the messages moveto, this
causes the bomb not getting away, as soon as i remove the left line to the 0 of the counter the bomb
is able to leave but as you'll see it won't work properly, because the bomb has to travel in a straight line.

and again suggestions are welcome

brendan mccloskey's icon

Hey
just wanted to chime in: like do..while, I love this but, UNlike raja (our resident anti-guru [I hope that's not culturalist or race-ist :p]), I am unable to help

keep up the good work!! or something - nostalgia ain't wot it use ta be

add some pew-pew noises and asplosions and this will ROCK

brendan mccloskey's icon

As in anti-hero. Like Hendrix.

brendan mccloskey's icon

"if you’re going to invoke my participation by using my name, be prepared for my mischief heading in your general direction, muahahahahahah-"

Absolutely raja, we expect nothing less; what I meant was more on the lines of anti-particle, rather than person opposing. Hendrix is the archetypal Western anti-hero, in that he appeared to be (or perhaps tacitly co-authored the illusion of) a reluctant, misplaced superstar. I have absolutely no idea where "anti-guru" came from (yes I do - several pints of Guinness whilst watching Holland versus Costa Rica). I think (foggily) that (in light of your recent gen~ work especially) I meant "he who IS a Max guru expert but would not describe himself as such" and then I immediately regretted typing the word "guru" because, as you point out, I am typical in not knowing the exact meaning - and implication - of the word. I should say anti-Max expert, but that's too heavy.

Peace

brendan mccloskey's icon

ps OP
when we gonna see/hear some pew pew sounds?

harrie88's icon

Sorry for the late reaction :S
Thanks Raja, it works great!! You are a hero

Btw you don't happen to know if it's possible to get the XYZ coordinates from the jit.gridshape from the enemy planes?
I know it's more of a jitter question but seeing that you guys already looked into the project you might be able to help.

If im able to get the XYZ position, I will be able to compare those values with the ones from the bullet so that i can "kill" an enemy,
and when all enemies (eight to be precise) are destroyed you win the game.

At the moment i'm working on letting the enemies drop bombs on me :O

harrie88's icon

Hey guys,

already fixed the last question myself,
i had to rebuild the whole animation of the enemies and the bullets,
but now i'm able to check their x and y coordinates,
which brings me to the next problem, how do I compare them?

at the moment I'm trying to use && and ==, but i need some sort of region because a flonum is so small that
the two will never be equal...

aaah well, have a look at the program and maybe you can add some information,
it might be a bit messy but the comments will guide you :)

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks in advance

brendan mccloskey's icon

Again, just from glancing at this, I suspect your [&&]'s stack need their hot (left) inlets triggered every time an enemy dies; also, you can't put spaces into send/receive names; use either [s enemyDead] or [s enemy_dead] for example.

HTH

ps comparison of duplicate/same coords might just be a matter of dividing each pair: eg, if Xa/Xb == 1, then collision is true. Perhaps you could rescale your coordinates so they are no longer floats.

Sorry not to be more focused ;)

Brendan

harrie88's icon

Thanks for the trigger advice totally didn't see that!

but spaces in send and receives do seem to work perfect, or is it just me?
and the last part I dont fully understand, divide which pairs and rescale which coordinates?

brendan mccloskey's icon
Max Patch
Copy patch and select New From Clipboard in Max.

for example:

vichug's icon
Max Patch
Copy patch and select New From Clipboard in Max.

very fastly, see attached patcher to understand what mischief the space in s/r pair can cause :

brendan mccloskey's icon

Ha ha, Max can even solve philosophical conundrums!

harrie88's icon

Ohw yes, I see, I'll change that, thanks

woyteg's icon

lol that made my day

harrie88's icon

thanks for the bondo, i'd never heard of that before!

I'm now able to read the x and y axis so i could destroy an enemy,
turns out I had lined them up the other way around.. took me 2 hours to finally figure that out.

the major problem now is the following:
after comparing the values with the "==" object and then the "&&" (so if the value isn't null) there's a small bang, but the enemy has to stay dead.
I could stop the metro of that object but then it's just standing there, what do you guys think i should do? a message with scale 0 0 0?

brendan mccloskey's icon

if you could post an updated version of your patch this sounds easy enough to solve

harrie88's icon
Max Patch
Copy patch and select New From Clipboard in Max.

OK, this is the updated version,
i've marked the patch "p enemy", that's where i'm trying to figure out the problem.

harrie88's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Sorry, that one's kind of messy,
here is a cleaner one:

harrie88's icon

Great enable tip, works way better now.
The only thing i run into now is that the bombs don't seem to hit me,
if they would, the user should turn red. it's in the patch "didigethit"

but it's a bit late for extreme changes, the assignment is due tomorrow

I had trouble uploading the compressed patch so for those who are interested or can even help out with the last part,
I've attached a zip file (sorry but thats what the forum guidelines told me to do)

Spaceinvaders.zip
zip