Interation between sprites

so if i have a single player with different possible interactions with other sprites (coins, enemies, checkpoints, etc.) should i be checking from the players perspective if they ran into anything or from the objects checking if theyve been run into?

Usually the 2nd approach will cut back on having many scripts in one sprite

But with Snap!'s tell and ask blocks, it's really just a personal choice

I think it really matters only if one of the sprites is hidden, in which case it has to do the testing.

ive been using those, but havent quite figured out an intuitive way to keep everything organized. it always seem to turn into something way more complicated than it should be, like i couldnt figure out why but one script was only running like halfway through and it just stopped, turns out it was a a clone that met a condition that was supposed to reset and in telling its parent to run the script, deleted itself effectively cutting off execution of the rest of the script.

ive also been experimenting with the broadcast to [some specific sprite / group] and passing messages that way, but still had similar struggles. i think i lose track of the actual senders / receivers because in alot of cases ive got a few choices to choose from.

one thing i worry about is performance (kind of alluding to @bh's reply here too), because i tend to start running into those kinds of issues when i start making these kinds of decisions, which in smaller projects usually the difference is negligible, but its often necessary to kind of migrate away from the naive solutions to a more clever, proper way, in terms of putting them into practice.

for example i want to put the when hat with a < touching [ player ] > or a forever if under when i start as a clone but im weary of those because ive seen discussion about how slow those methods are, and i see things like untitled script pic(115) and untitled script pic(116) which i feel like may end up doing more of the leg work under the hood so im not running each test as a snap script every frame for all different interactions you know, i feel like some serious jens knowledge would maybe help me find my way here but he usually finds something to rant about before he wants to show off his cool computer science wizardry. sigh. back to testing i guess, the ol grind. lol

Yeah, MY NEIGHBORS is specifically about efficiency, cutting down the search space for you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.