May i have your attention please?

0 favourites
  • 5 posts
  • So now that i have your attention my problem is that:

    i am making a cannon shoot game and i have a cannon that shoots bullets towards the mouse. i fill the distance

    between the cannon and the mouse with 10 dots that pointing the target.

    Now i want that dots to disappear when they are overlapping a wall and to reappear when they are not.

    Something like that lets say the dots is counting 1 from the beginning(cannon) to 10 mouse(target) .when lets say the fifth dot overlaps a wall i want to disappear the fifth dot and all other dots that reach the target(6,7,8,9

    and 10) and when there is no overlapping i want to reappear.

    something like that.

    all dots

    ----------

    overlaps wall

    ----|

    after overlap

    ----------

    keep in mind that i don't want to create a new dot every tick something like this if dots<10 then create dot.

    I am pretty sure its tricky.

    Any help or suggestion please?

    thanks!

  • hmmm....

    If you want "Dots" to always be there (you create them in the editor and never destroy them in Runtime)... you can make instance variable in them (let's call it DotID) and number them from down to top.

    if the third Dot (DotID=3) overlaps a "wall" then change Visibility or Opacity of all Dots with (DotID >= 3) to make them invisible. if no "Dot" overlaps "Wall" make all Dots Visible.

    I hope this helps

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • https://dl.dropboxusercontent.com/u/108 ... iming.capx - Try playing with this, it works on low angles like 10 degrees, but as it's half past midnight, I'm too tired to work out the rest of the code, but you can have a play with it and try to get it working <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • hmmm....

    If you want "Dots" to always be there (you create them in the editor and never destroy them in Runtime)... you can make instance variable in them (let's call it DotID) and number them from down to top.

    if the third Dot (DotID=3) overlaps a "wall" then change Visibility or Opacity of all Dots with (DotID >= 3) to make them invisible. if no "Dot" overlaps "Wall" make all Dots Visible.

    I hope this helps

    i don't understand the trick with variables.

  • Never mind i solved it

    in case anyone interest is similar the way ahmadmanga mention

    i make 10 dots to fill the distance between the cannon and the mouse with a loop ,

    then i make a global var with the number of the dots in my case 10 so globdots =10

    when dot overlaps wall globdots=dot.iid else globdots =10

    then system pick by comparison dots globdots <=dot.iid set opacity to 0 else set opacity to 100 .

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