So I am making this game and I am spawning rings randomly on top of the screen, which they then fall down onto a stick. I have the win/loose mechanics figured out, but the ring is on the top most layer so when it lands on a stick it looks bad as it just goes above it. So I split the same ring into two parts a top and bottom, so that when it did fall onto the stick the top of the ring would be on top of the stick and the bottom part of the ring would be behind the stick making the visual affect that the ring fell through the stick. I cant figure out how to make those two sprites be on different layers, but still have them in containers so that they would be randomly spawned together. I will attach what I have, and I have been experimenting on "GameInfinity", and the "GameSpeed" is what I had initially. If you play the "GameInfinity" you will see that the rings do go through the stick, but only randomly as in sometimes they do and sometimes they dont, and I think thats because of the "containers", but I have no other idea of solving this issue. I tried using pinning, but for the life of me I cant get it to work.
Thank you for your help.
I think to have a solution but i'm not at home, I'll try it in 4 hours
You don't need separate layers. On the ring's creation you can set up an action to move the z-order of the bottom of the ring to just under the stick, and set the z order of the top of the ring to just above the stick.
Okay thanks BouncyTrip.
Bladedpenguin- See if I do that both of the top and the bottom part of the ring goes to that layer as i have them in the "container" option. Without the container option they dont spawn together when the command is run, but rather 1 spawns and then the other.
Woah! It is harder than I imagined! I'm sorry to tell you I have tried to fix that, but i needed to stop because i must go to work now...
Anyway I saw your project is in 1920x1080 but it is for mobile. You should set it to 540x960 for some reasons:
-Smartphone screens have high dpi values and that lets you create small images with an unexpected HD effect
-Handling too many big images could lead to low performance
-You greatly reduce Download size
I suggest to use 480x800 because if you scale it in "scale outer" mode it will fit any screen out there.
*Tomorrow I'll retry to fix those rings in case you 'll still need help
Meanwhile you could try this:
1) Remove any container
2) Use RingTop as bullet, and just use RingBottom as a piece of Ringtop.
3) Just after ringtop is created on "layerTop", add these actions:
-|Ringtop| Spawn object Ringbottom on layer "layerbottom" at imagepoint 0
-Pin ringbottom to ringtop
Thanks man I will try and see what I can work out, as I am a total beginner at this . As for resolution size I dont understand how it better to up scale, wont things look blurry? And how will my object as in the stick still be kept alligned to the overall size?
When you create an object from a family it creates a random one so half the time it's creating RingTop on the bottom layer.
Change the 'Create object' event to spawn a RingBottom on layer 1 (or a RingTop on layer 3).
Thanks, but I just tried this and I am unsure on where to put "RingTop spawn RingBottom on Layer 1" or if I am even doing it correctly. But then this bug occurs that the rings just get stuck on the top of the screen or if I tweak the code they are only visible from the bottom half of the screen, and also if they are not in containers just the bottom half of the ring is shown.
I basically just need two sprites connected together, but are on different layers or on different Z order. And I know the pin tool would be the most logical solution for this problem, but I still cant get it to work after watching youtube videos or reading solutions on the forums.
I meant create not spawn. Just change the object in your create event from RingS to RingBottom.
Okay, but the reasons I had to creating RingS, is because my pin behaviour does not work, so I had RingS created with the container selected on RingTop and RingBottom and that way they would move together, if this makes any sense. But yeah the real problem is pin not working :'c
I made a bug report here. I can't see why the move to layer action isn't always working for your top sprites.
Okay thank you, could it do something with having the RingTop and RingBottom in the same container?
I think so. Here's how you would pin them together anyway:
Develop games in your browser. Powerful, performant & highly capable.
Wow thank you soo much thats what I was going for and had no idea about the caught command so instead I was going to track the rings position relative to the stick, but caught makes it so much more elegant. I figured out the pinning and and layers right before i read this i will attach a screenshot of what I did just for reference and if anyone else needs it.