Hi guys, if you look at this it might be easier to explain what I’m trying to do…
MY MINI-GOAL:
(0) Let’s call the green blocks floaties and the red blocks bumps
(1) When Icarus hits a floaty with a feather it turns into a bump.
(2) I want to limit Icarus to picking up only one bump at a time, i.e. after he has one I want any others that happen to be on screen to stay there even if he touches them, until (5) happens
(3) When he picks up a bump it shows on the HUD
(4) When he has a bump his projectile changes from a feather to fries(just a placeholder for now).
(5) When he fires the fries, his projectile changes back to a feather, and he can pick up bumps again.
MY PROBLEM:
I’m struggling with (2). Is it possible to send a msg.post(…), from the icarus.script to the bump.script? At the moment the bumps are generated using a factory which is triggered when a feather hits a floaty. I want to send a message that can hopefully temporarily disable collision detection only between Icarus and the bumps, when Icarus has already got a bump. I’ve got a boolean flag, “pick_me_up” in the bump.script to hopefully help with this:
if message_id == hash("contact_point_response") then
if message.group == hash("icarus") and pick_me_up then
pick_me_up = false
go.delete()
end
Now my hope is that after I fire off fries that I’ll send a message to the bump script that will then change the pick_me_up variable back to true. In this case a go.property() wont work because I want to affect all instances of the bumps when I flick the pick_me_up switch not just individual instances. I’m hoping that I can change the state of all bump instances dynamically. Is this even possible?
-
I’ve tried: msg.post("/bump#script", “set_pickupable”), which I knew wouldn’t work but I still had to give it a go.
-
I’ve tried: msg.post(“bump#script”, “set_pickupable”), which I thought might work, but it didn’t. I get this error message: Instance ‘(null)’ could not be found when dispatching message ‘contact’ sent from default:/icarus#script
-
I’ve tried sending a message from a bump that’s been collected just so I can get its url so I can send a message back to it, but because I delete bumps straight away the instances no longer exist. So this didn’t work either.
Any suggestions? Can this even be done? Cheers
PS. I’m not entirely convinced that the collision group with a boolean thing will even work properly. It doesn’t seem to be working very well on some experiments I’ve done. I think I’m misunderstanding something about life-cycles or the frame rates are throwing something off, but that’s a story for another day.