Good evening, fine people. I’ve been going round and round on this and have tried several things.
Here’s what’s currently working and I’m trying to do:
In Level 1 of my game I have these magical flowers that appear and disappear based on their alpha values. Random number generates a value and anything less than a certain number it stays invisible, if over that it’s 100 and visible. I’m sure there’s a more elegant solution, but this is my first game and I’m still learning…
These magical flowers are power ups and update a power up bar that adds a life when five have been collected.
When a collision between the player and the visible magic flower (resource) occurs, an animation and a sound play, and then the bar updates as expected. All great. However, sometimes the animation, sound, and bar update when the space is empty as well. This should not happen. I would also like each magic flower to destroy itself when it collides with the player, so that there are not infinite chances to just keep adding more lives.
I have the alpha behavior in the Resource sprite and the collision behavior in the Powerup Meter Bundle in the Player (bee) sprite.
I’m attaching screenshots of the latest things I’ve tried. Grateful for any insights. Thank you!
Thank you for your lightning reply! So, just to make sure I’m getting it…after the alpha block, use a filter to make sure it’s 100 and then allow collisions? I’ll try that RN. Thanks!
Have it to where;
If the filter is activated true, then it send a message saying something like “on”. If the mailbox block in the player receives the message “on” then it will turn on a switch in between the collision block and activating the power-up. Do the exact same thing for the off switch, only it tests for the filter to fail and it turns off the switch. If this doesn’t make sense at all, then I’ll make a screenshot for you.
I think I get it. I’m going to step away from the computer for some fresh eyeballs and I’ll give it a try. Thank you! Here’s a link to the game. Only level 1 is kinda working right now.
Hello @MrsBrune, as you have seen the alpha value doesn’t affect collisions. You can turn the collisions on and off using the Enabled block (in the properties section) https://flowlab.io/behavior_handbook/#properties-enabled If you disable the blocks this way, they will not trigger any collisions.
Also, you can use a Destroy block to destroy the flowers as they are collected.
Still, other objects like projectiles might be able to destroy powerups. This would be a wrench in the system if anything like that happened so I was trying to find a way around it. I see your point though lol.
Can you still animate them though they are disabled?
(PS sorry @grazer but it won’t let me press the “reply” button for replying to you so I have to at you. )
Thanks @grazer. I think I tried this, but not quite sure I got it right. I added the enabled blocks, but I wasn’t sure exactly how to make sure it destroyed itself, since I don’t have a need collision=> destroyer connection. I had two places where this logic was before, in the powerup bundle in my bee sprite that does the collecting, and in the magic flower itself. If I’m trying to extract its alpha, I’m not sure how I can destroy it…
In any case, now the magic flower is collectable only if it’s visible, which is awesome, thank you! However, since it does not destroy itself if the bee hovers in that spot it can keep gaining powerups over and over. I have a limited number of these placed around and want to only have three or five—haven’t decided yet, and have them destroy themselves so that you only really get one extra life.
Sorry for the rambling reply. Super tired and gotta get ready to teach my kiddos in the AM. I appreciate the troubleshooting. I tried linking the game earlier and I guess that didn’t work…trying again.
I know in game settings you can allow the gane to be seen in game list. That should do the trick. If it doesn’t, then it’s something special for education edition users that I don’t have (I tutor on flowlab with education).