Arcade-sprite-events extension

Hey folks!

If you’ve been watching stream for the past couple weeks, you might have seen me working on a new arcade extension. Well, I’m pleased to announce it’s now available! Check it out here:

This extension adds new events that you can use with sprites in Arcade. Below is some quick documentation on how the events work.

Tilemap events

This event block gives you a lot of events that are useful when using tilemaps. Here’s an explanation of all of the different sub-events:

  • starts overlapping - runs once when a sprite starts overlapping with any tile that has the given image
  • stops overlapping - runs once when a sprite stops overlapping with any tile that has the given image
  • fully within - runs once when a sprite is fully within a tile with the given image (i.e. it’s only overlapping with one tile and that tile is the selected one)
  • no longer fully within - runs once when a sprite that has been fully within a tile with the given image starts overlapping with another tile
  • fully within area covered by - runs once when a sprite enters an area where it is only overlapping with tiles that have the given image. Very similar to the “fully within” event but it will run even if you’re overlapping with multiple tiles as long as they are all the same kind
  • no longer fully within area covered by - runs once when a sprite is no longer fully within an area covered by tiles that share the same image

Sprite events

This event block gives you more options for the standard sprite overlaps block. They are:

  • starts overlapping - runs once when a sprite starts overlapping with another sprite of the given kind
  • stops overlapping - runs once when a sprite that has been overlapping with another sprite of the given kind is no longer overlapping with them

Region events

Region events let you register events that run when a sprite enters or exits a certain part of the game world. In addition to using tilemap locations, you can also define regions using pixel coordinates. The different events are:

  • starts overlapping - runs once when a sprite starts overlapping with a region
  • stops overlapping - runs once when a sprite stops overlapping with a region
  • fully within - runs once when a sprite fully enters a region
  • no longer fully within - runs once when a sprite is no longer fully within a region
14 Likes

If you have any feedback or find any bugs, feel free to file them either in a github issue or comment here and tag me.

2 Likes

I’ve been waiting for something like this! Awesome!

2 Likes

Hooray! Just the extension I needed for my new game, thanks so much! However, I noticed that one of the blocks that issued overlapping with the tile doesn’t say “at location”, which is a little inconvenient for me because I wanted the tile the pointer was fully overlapping to turn into another tile. Is there any possible way you could re-edit that a little? A million thanks!!!

@PrinceDaBezt123 thanks for the feedback! This is something I’ve been going back and forth on how to support. It’s not always clear what location should be passed to this event.

Here are a few questions that I’d love to get your (and everyone else’s) opinion on:

  1. If the sprite is overlapping with several tiles of the same type, which location would you expect to be passed to the event? Should it just be a random one? Should it be whichever one you’re overlapping with more? Should it always be the one that’s closest to the top-left of the screen?

  2. For the “stops overlapping” and “no longer fully within” options, which location should be passed to the event? Should it be the tile you just left or the tile you’re entering?

@richard Thanks for your reply! To answer your first question, I think that it should be the one the sprite is overlapping with more. As for your second question, I think it could be the tile the sprite is entering.

Hi @richard
I have not try this in a real project, so my opinion below are just based on my imagination :joy:

  1. All tile overlapping or leaving (in array) if possible. Or the more overlapping (or before leaving) tile, if not.
  2. Return tiles entering for starting overlaping, and return tiles leaving for stop overlaping. This would be more “logical”, I think. If you need return new tiles entering when “stops overlaping”, these should be triggered by another “start overlaping” for that kind of tiles.

Hope it helps.

It was great seeing the back end and the creation of an extension. I hope the team does some more in future streams!

@rymc88 I plan to keep doing these on fridays!

2 Likes