GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How to disappear a line then appear again ?

alkait.99alkait.99 Posts: 3Member

Hello,

I have been looking for this rules and i didn't found it!. I don't know if someone posted or not by the way.

What am looking for is, two things.

1) I have already "how to draw a line" but i want it to be with a limit not whole screen (Like i adjust the width/hight in the rule and the player draw it what i want).

2) Complete with the above. and i want to let the player every time draw the line when the ball hit it disappear --> after that he can draw another line.

Thanx in advance.

Comments

  • tintrantintran Posts: 453Member
    edited July 2015

    something like this?

    I made 4 stationary walls to trap the ball inside game screen.
    Made a blue actor called it screen and covered the screen with it to detect touches inside this actor/screen.

    Then when user touch is pressed i record the touch1.position as start position
    Then when user touch is released i record the touch1.position as end position
    and check to see if number of lines is zero then i make a line actor facing 90 degrees + angle of start position to end position.
    Then inside the line actor, increment lines counter so user can't create another line until this one destroys itself i change his width to 3 and his height to be magnitude of start position to end position.
    I added rules to detect when a line is collided with ball, i decrement lines counter so that another line can be created, and destroy the line actor.

    To draw line click on start point, drag to some position to draw line to and let go of the press.

    If you want it to be limit where you can draw a line, you can just resize the blue screen actor to whatever size or whichever area you want, and it should work

  • alkait.99alkait.99 Posts: 3Member

    Thanks a lot .. you saved my time

    @tintran said:
    If you want it to be limit where you can draw a line, you can just resize the blue screen actor to whatever size or whichever area you want, and it should work

    ya it's work .. but i want the user use the line with limit and any area
    For example, i want width = 60 height = 10 only the user can draw it no more!

    possible right ?

  • tintrantintran Posts: 453Member

    like this?
    I just set it so that if touch is released or if magnitude() of current touch - start position is greater than or equal to 60 then make that the end position of line.
    and in line i make the height = min(60,magnitude of endposition - startposition)

  • alkait.99alkait.99 Posts: 3Member

    @tintran Thanx a lot .. that's what am looking for :#

Sign In or Register to comment.