How to make a tappable point at an intersection of two lines?

We have two (laser) lines moving about, and we want to make it so that when the user taps the intersecting point of the lines, they gain a point. How would we go about do that in GS?

(The lines keep moving and shifting, thus the intersection continually shifts as well.)

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Hi @ineedhelp and welcome to the Forums and GSC.

    Interesting choice of Forum name.... I'd choose a more positive name personally! Maybe something to do with the type of games you're making?... (But up to you, of course...) :wink:

    Also interesting problem; a question first though: is each of your lasers created with a single actor or is the line (laser) made from Replication or duplication of points?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ineedhelpineedhelp Member Posts: 12

    each laser is an individual actor

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    OK. When I first read your question I began to think the answer involved vectorToAngle, etc., but after a quick test, I realised its relatively straightforward.

    So there's possibly still a couple of other ways to do this, despite its simplicity; here's one way:

    Make an integer attribute called LaserTouch, another integer for your points, let's call it, er...Points and a third, a boolean called Go.

    Now in every one of your laser actors, put:

    Rule: When touch is pressed
    Change Attribute Go to true
    Change Attribute LaserTouch to 1
    

    Make a blank actor, put it outside of the screen area. In it's Rules, put:

    Rule: When Go is true
    Rule: -- nested-- When LaserTouch = 1
    Change Attribute LaserTouch to 0
    Change Attribute Go to false
    Otherwise
    When LaserTouch = 2
    Change Attribute Points to Points+1
    Change Attribute LaserTouch to 0
    Change Attribute Go to false
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    There are probably many ways to do this. In addition to @gyroscope‌'s excellent advice, here is yet another way.

    The basic idea is to have a touch sensitive 'intersection' actor. The laser actors are tracked to the 'intersection' actor.

    If you make the 'intersection' actor invisible, it will give the illusion you are looking for.

  • ineedhelpineedhelp Member Posts: 12

    Okay this is what I have right now.

    Line 1:

    Line 2:

    The blank actor outside the screen:

    And this is my screen, if it be of interest:

    in which the big white box is an actor displaying ‘points’ and the small box is the intersection blank actor. right now the lines aren’t moving, but they are overlapping, but when i go into preview and click the intersection, nothing happens to the points.

    if you must know the points actor looks like this:

    Thanks for the reply though. I see your logic… it just doesn’t seem to work?

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Hi @ineedhelp Your pics aren't showing up in your post- (as you can see as well, I'm sure) - png is the default for images into GSC but jpeg is the standard for posting pics in the Forums- so now you know for next time. :smiley:

    Here's the little test file I made, for you to see what's going on & compare with your version:

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ineedhelpineedhelp Member Posts: 12

    actually i can see the pics on my side. but i see what i did wrong now. thanks so much!

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    @ineedhelp said:
    actually i can see the pics on my side.

    Ah, OK! Maybe...maybe... :smile: Prob. best to stick with jpegs tho' in future then you can be certain of every type of computer screen "seeing" it.

    @ineedhelp said:
    ..but i see what i did wrong now. thanks so much!

    Good stuff and you're welcome; glad I could help. :smile:

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.