How do I a indication item on the edge of layout

  • Hello friends,

    Please help me on making an indicator for incoming objects(missiles in this case) towards the player, the indicator will only be stuck to the border of the layout and when the object enters the screen that indicator will then disappear

    Thanks

  • www28.zippyshare.com/v/r1Zzy8jE/file.html

    Done!!

    Thanks for replying PixelPower

    But this is no were close to what I was talking about, anyway, I've uploaded a picture to make it clearer.

    so in the picture red objects are the missiles coming towards the player(green) and the red triangles are the indicating objects that will inform the player that something is coming from that direction.

    Hope you understand it this time. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy" />

    postimg.org/image/863l9o9z1

  • > www28.zippyshare.com/v/r1Zzy8jE/file.html

    >

    > Done!!

    >

    Thanks for replying PixelPower

    But this is no were close to what I was talking about, anyway, I've uploaded a picture to make it clearer.

    so in the picture red objects are the missiles coming towards the player(green) and the red triangles are the indicating objects that will inform the player that something is coming from that direction.

    Hope you understand it this time. <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    http://postimg.org/image/863l9o9z1/

    Ok this is a variation that looks like your photo. You wait 2 seconds, indicator comes on and 1 second later enemy comes on the screen.

    http://www92.zippyshare.com/v/OuSQROhI/file.html

  • you could do set X at a constant rate and then set Y at the object Y ?

    If you want a bottom too just do the same except reverse. ? would that help ?

  • you could do set X at a constant rate and then set Y at the object Y ?

    If you want a bottom too just do the same except reverse. ? would that help ?

    That would help alot but I don't think the OP would understand that. The 1st capx file I sent gave the basic principle and yet the OP said it wasn't even close to what they wanted. That means the OP doesn't understand events fully yet. All the OP had to do was use the same logic to accomplish what they wanted to do.

  • amitkuliyal

    A lot easyer with a certain plugin. But last time i used that, panic hit the pan.

    So ... without a plugin :

    https://www.dropbox.com/s/2jasga2cfo6nm ... .capx?dl=0

    Have Fun.

  • Sorry guys for not replying this long actually i was first testing/ trying to get use from the logic everyone suggested here but unfortunately, i couldn't figure it out.

    The problem here is: my player (plane with car behaviour) is rotating all over( with unbounded background) and the missiles are spawning randomly somewhere out of the layout(or rather around a moving layout) and now whenever a missile gets close lets say 100 pixels away to the layout, an indicator will spawn and keep tracking the missiles action till it enters(or hit the indicator item) the layout.

    I liked the idea that Gearworkdragon suggested and i'm working on this logic to make it work for now it only spawn the tracker at the right position on the layout edge but not following the missile.

    BTW 99Instances2Go what is that plugin you are talking about? and your way is fine but for my game it doesn't work the way i want it. I am making an example file that i'll share hope that would make sense to everyone

    Again thanks everyone from your help.

  • Guys here is a demo Please have a look

    www108.zippyshare.com/v/TY2uEmGU/file.html

    now i wanted to show the indicator on the edges of the screen, see if you can help me on that

    Thanks

  • There are 2 plugins that can help you with this.

    To raytrace ...

    With the plugin you can do it like every ticK.

    To predict interceptions.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think something got misunderstood here.

    This is as described in your image. The indicator is based on the x/y of the projectile, constrained to the viewport bounds. I think this isn't the end effect you are going for though...

    https://www.dropbox.com/s/xy8pszf48lqo8 ... .capx?dl=0

    If you want an indicator to show where the object is expected to enter the viewport based on angle of motion, you'll need to raycast and see where the ray intercepts the viewport bound and as 99instacesgo suggests. There are ways to do this without plugins as well, but it is an intermediate-advanced task. https://www.scirra.com/tutorials/902/li ... raycasting

  • hmm have you tried doing something like if missile is 100px away from layout edge and then sub event

    I want to say like create the indictor at the edge and then every tick its new Y position and when missile is with-in layout stop following and destroy the indicator.

    But i know that wouldn't work because you would have multiple of them and Im not sure how you would say lock each indicator to a missile without conflicting 50 other missile. Maybe using container such as instead of destroy the indicator you could simply make it invisible and when you destroy the missile you destroy its indicator ? so that when you go faster then the missile out of the screen it could reappear ?

    this is just me brainstorming possibilities.

    The hard question would be how would one code that logic without overwhelm the cpu event from re-firing when there is two different state for the missile object such as one could be in the layout and the other one on the outside at the same time.

    But yeah you can try the plug-in never used them yet.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)