Line Rendering for 2D Connect the Dots Game
Hi I'm new to Unity and have a question about restricting the player's ability to draw lines while playing this game.
My 2D game involves the player drawing lines between pairs of dots in a grid of provided dots. I only want the player to be able to draw lines between two dots but no where else on the screen.
I've made the dots into game objects and added circle colliders to them so I could use OnMouseDown() in the Dots script, to enable my DrawLines script that allows the player to draw lines with the 2D line renderer when Unity detects the player has clicked on a dot. I've got the line rendering down but still the player can also draw anywhere else on the screen :( (I think my problem is that I can't visualize when and in which script to disable the DrawLines script.)
How can I restrict the player's line drawing only from dot to dot?
Which exact procidure do you want?
1.
Player clicks dot1
Linerenderer is created (Goes from dot1 to mouse)
player moves mouse to dot2 (line follows)
player clicks dot2
line snapps to dot2
2.
Player clicks dot1
Player clicks dot2
Line is created already connecting the two points.
3. Other
Please specify :)
Hello. I also want to create a game of such type (dots connection 2d) . But I newby in Unity and I don't know from what I have to start? Couldn't you please say me, from what to start to create such game? On what I have to pay attention firstly?
@Brullix3000 , please look at my comment above
Answer by nebushaa · Oct 25, 2017 at 07:54 PM
Has anyone of you by any chance done the first procedure please .. @Brullix3000 , @magister_yoda_ and @zsolti .
1. Player clicks dot1 Linerenderer is created (Goes from dot1 to mouse) player moves mouse to dot2 (line follows) player clicks dot2 line snapps to dot2