I’m having trouble with calling the enemy_collision component from the spaceship script:
I’ll be honest and say that my understanding of url and messages in general is offensive.
I’ve uploaded some images so you can see how the template project outline is set up.
Any advice is much appreciated.
This is one of those fundamental things I HAVE TO LEARN and if I do, I believe I will be able to make huge strides.
I’m not a programmer, not even a scripter but I do know that with coding small gaps in knowledge can be crippling and if those gaps are filled it can lead to amazing results.
hey @FILMon, not sure exactly what you’ve got set up in the enemy_collision, or how that fits into the main game/level. What is the enemy actually supposed to be colliding with? The main player?
Do you know if the initial collision message is being passed? You can check by adding, to your on_message function:
if message_id == hash ("contact_point_response") then
pprint(message)
end
This will let you see exactly what is being sent in the collision, including the sender url (message.other_id)
It looks like the enemy objects are populated as instances from a factory. The other_id is showing up as “/instance” plus a number as in “/instance9”. I don’t think that’s anything I can use but i’ll keep working on it and post back soon! Any advice until then is much appreciated as usual.
@FILMon
It looks like part of your problem might be the “group” and “mask” properties of the 2 interacting objects. The “message.group” that you see in the pprint is “default.”
You’ll need to make sure that in your collision object you have the group and mask properly set for the 2 objects you want to interact, for example:
Enemy collision object, “group: flying_enemy”, “mask: player, ship, bullet, stars” (basically anything that the enemy should be able to collide with)
other collision object, “group: ship”, “mask: flying_enemy”
Then when you check out the pprint of the message you should see “group: ship” (or whatever the object is).
Then in your on_message code for the enemy you can put:
if message_id == hash ("contact_point_response") and message.group == hash ("ship") then
(collision code goes here)
end
This way you can make special collision code for each object the enemy is able to interact with, by categorizing each collision by the “group” assigned to the object collided with.
Hope that makes sense…I’m also fairly new to this whole thing, but have been having some pretty good successes!
No problem @FILMon
I’m in pretty much the same boat as you. Not a programmer at all, but having a lot of fun in Defold. Started working on something back in January with my brother, but we put it on hold at the end of March because of other responsibilities and whatnot. Just recently started working on a new project for the Defold/Corona game jam. Hoping to have something playable by the deadline (end of September). If you think you might have your game finished by then I’d recommend checking it out:
If you haven’t noticed yet, the defold forums are pretty active and very helpful. Good luck on your first game!
Im losing Momentum
Okay after playing around with Defold some more I realized something. I’m a Designer by trade and I love productivity. I cook as well and same thing. I hate loss of momentum. That’s like my pet peeve. So I realized that my mind going from Conceptualizimg to Designing to Coding to Conceptualizing Code which is different is just so unproductive…for me anyways. So I’m going to Project Manage the mess out of this thing. I’ll also need the communities help.
The Plan
I’ll focus on momentum. So for example I just learned to detect a specific enemy, thanks again Ryan, so I’ll ride that wave and create all my enemy characters and grab items for level 1.
My Sprint Goal
I’m going to go with 5 Characters per stage and 2 Grab items and maybe treat them like Pokémon where they look like evolutions of one another.
More Blabbering
I’ll worry about functionality later. I at least know how that I can code collision and detect it. That’s good enough for me, for now. Time to maximize on that.
So, time for me to shut up and enjoy building 5 red characters and 2 grab items.
Thanks Alex! Would love to. I don’t know how yet but I’m sure it’s on the site somewhere. I’ll go ahead and look it up now and share a link. If I have trouble I tag your name in a post here ^^
Awesome thanks Alex! I just created the itcho.io account but I gotta start driving to work now so I’ll upload it after work
In the meantime my next sprint will be a graphical one since I’m already fired up. I’ll create all the assets for Level 1: Lush Forest, trees, mountains, birds, dear etc ^^
My Phase 1 will only be to create all the Assets for Level 1 ^^