Hi, I’ve apparently been trying to make this work since the 6th & after checking the various tutorials & trying my best to make head or tails of how the the public example of ’ Rotate, move and fire’ functions the way it does to give me another clue, I’ve finally decided to ask something of a complicated(At least as far as describing it in the title of this thread goes) & seemingly yet unanswered question:
Basically, I am trying to at least give the illusion that the current screen my character is on has flipped horizontally & faded to a black background after my hero character has collided with an enemy. This is supposed to be a transition to a different screen where a turn-based battle takes place. But unlike the random wild encounters of old I’d like it to begin when the hero/player runs into an enemy.
I eventually figured-out each enemy needs to be in a different ‘group’ from the hero & that it seems setting the ‘masks’ of the hero & enemies to the corresponding(Or perhap opposing? ) ‘group’ is how their sprites colliding is detected in the ‘Console’ for troubleshooting purposes, but I can only understand so much from what’s below:
Whether I should or shouldn’t I have been using the base assets & layout from the Defold RPG Tutorial while trying to use the code from other scripts & tutorials to make heads or tails of what I’m supposed to do to make this work. Below are the relavants bits of attempts at coding to make this work followed by the settings I’ve tried to make everything else look right & get the ‘Bee’ from ‘Map_0-0’ to send the message to the right URL(I would argue this is the closest thing to a concise explanation of the bug I’m experiencing, while this section is what make that clear. But if not: the first image is what I get when my ‘Hero’ collides with the ‘Bee’ from ‘Map_0-0’ as opposed to the desired result which, I attempted to achieve with a workaround described below the next 2 images alongside the expected behavior) :
Hopefully what’s above can give you a good idea of what I was going for below:
Below this is what I’m trying to activate, by checking-out either **The Defold Team’s explanation video #3( https://www.youtube.com/embed/1kiLHUkL8HI ) or #5 ( https://www.youtube.com/embed/aFLhNqst7j8 ) ** I thought I could achieve my goal by screencapping the map in question, scaling up the image in ‘Paint’, and using it for a seperate Game Object with the following Script like I believe was done with the ‘Gem’ in explanation video #3. Then I would have that spawn/load behind the map via the right Z-Axis coordinates, delete said map, then flip the Game Object horizontally, hence why the mere illusion of the map flipping horizontally would suffice. Here’s what I tried to achieve it:
It occurs to me now that I should probably add a delay to the equation so the image rotates enough before it’s deleted just so it looks right, but at the moment I’d like see the effect work first imperfectly or otherwise before tackling how to make it look nice, let alone how I’d prefer it. Below is just further reference for what I was using in my attempt to achieve my desired effect, compare it to the ‘Bee’ & ‘Map’ Scripts above to see how it’s relavant, other than changing the # to ‘2000’ so my character moves faster(***Even if I’ve lost count of how many times my character has plowed through the tiles ^v^; * **) everything else has remained the same in that script from the base RPG Tutorial Code:
The rest are the settings:
I added a score using the side scroller tutorial’s settings in preparation to keep track of things like ‘HP’, afterwards I decided to focus on getting the ‘battle’ to start first before worrying any further about the interface.
The aforementioned Game Object workaround. At the cost of having wasted hours typing & arranging all of this post, I tried the URL in the image above, colliding with the ‘Bee’ made Console give me: ERROR:GAMEOBJECT: Component ‘/collection0/bee#map.script’ could not be found when dispatching message ‘load_screen’ sent from main:/collection0/bee#bee
This might be the most altered collection from the tutorial’s Base settings , at the bottom of the outline is a MapFactory that leads to the Map Game Object for the aforementioned transitional purpose. It didn’t work so I added the GameObject to the same ‘Root’ as the Sender which is ‘Bee’, but to no avail.
And that’s everything I can think of to share in order to seek help with my issue.
It occured while typing this that my issue could be as simple as adding a Function Init(Self) to the Map.Script & that some might find it amusing how I’ve managed to make something so simply achieved instead needlessly complicated, or conversly to others how I’ve made my explanation so long & confusing that they’re not quite sure what I’m asking in spite of me doing so specifically to be thorough.
What can I say? I am but a greenhorn, one who started both developing in Defold & coding in Lua at the absolute tail-end of October 2023 & gaining exactly 0% additional expierence back in December. And rather than waste more dayS trying to figure this out on my own, I’ve decided to humble myself & ask for help, hopefully the fact my Thread’s Title didn’t recommend any Threads that answered my question isn’t to suggest I’m the only oe whose tried to do this in Defold. If by chance my question HAS already been answered in a different thread, please point me in the direction of said Thread.
If the mods decide to move this thread to a different category, sorry for posting this in the wrong place.
If a few other threads are to go off of, if I really have lost people during my explanation it seems like it’s acceptable to resolve through addional responses. So please ask away & I will try to clarify things to the best of my limited ability.
And with that, it’s quite passed midnight for me, I look forward to any advice for resolving this issue ASAP. Thanks in advance