[Extension] arcade-multi-events

Hey folks!

I whipped up a tiny new extension today for a game I’m working on and I thought I’d make a post about it since it’s pretty useful. I present: riknoll/arcade-multi-events

This extension gives you new versions of all of the normal sprite events:

  • on created
  • on destroyed
  • on overlap
  • on overlap tile
  • on hit wall

Except now you can pass multiple sprite kinds at once instead of just one!

multi-events-kinds

And, in the case of on overlap tile, more than one tile as well!

multi-events-tiles

But that’s not all! This extension also gives you an extra version of each block which can be used locally. Now you can define your events using a loop!

multi-events-local

Enjoy!

25 Likes

OMG i’ve been dublicating each bit of code for so long!

7 Likes

This is awesome, just what we needed! So much code can now be optimised!

6 Likes

Yay! Go @richard!

4 Likes

I kinda slept on this before realizing that FF:F REALLY needs this one. Nice!

2 Likes

There is no video?

1 Like

ABSOLUTE REVOLUTIONARY

2 Likes

@MyCraft_Steve its arrived now you should come back lol

1 Like

this block doesn’t work right (idk how to explain it): [on (sprite) of kind (Player) overlaps (otherSprite) of kind (Player)]

2 Likes

whoops, fixed!

3 Likes

small example of this extension being used:

wasd (or arrow keys) to move. z & x (A & B) do nothing. you play as the gray square. run from the red square, the small red pellets, and the shooter thingy. kill the red square using the small red pellets.

1 Like

@richard what have you done? You just don’t know how much this is to me.

2 Likes

Took me a hot minute to figure out how much optimization I could really do with this.

Question, could I use multi overlaps with jerwundls (I don’t know how to spell it, and I won’t bother.) sprite utils extension and use the on sprite update every 500 milliseconds in the multi overlap? If you need an example I can provide one, I know I’m not great at explaining things.

3 Likes

yeah, give me an example. not 100% sure i know what you’re getting at

3 Likes

does this work?

I was asking this because they both ask ¨Sprite¨ but they can both mean different things.

2 Likes

i think that should work fine, though you won’t be able to reference the outer sprite inside the inner event.

that being said, be careful doing that! overlap events fire every frame so this will keep re-registering the update code unless you change the kind or something

2 Likes

I may not be correct, but i think if you replace the mysprite with othersprite it might work

4 Likes

You should probably forcebrute the parameters just to make sure.
Go into JavaScript or Python and modify

function(sprite, otherSprite)

just to make sure, you know?

1 Like