Actor walks on line path

gambetgambet Member Posts: 38
edited November -1 in Working with GS (Mac)
Hello,

Is it possible to move an actor on predefined line (see the image)?

[URL=http://imageshack.us/photo/my-images/7/bozeforum.png/][IMG]http://img7.imageshack.us/img7/2568/bozeforum.th.png[/IMG][/URL]

http://imageshack.us/photo/my-images/7/bozeforum.png/

I want when the actor spawns to random choose between the three lines an then to walk from the beginning of the line to the end and then destroys.
Any idea how to make this.

Comments

  • DrGlickertDrGlickert Member Posts: 1,135
    You'll have to use lots of rules, lots of exact numbers (in my opinion).

    Start with a self.attribute: self.path (integer type)
    Start the actor with a Change Attribute self.path to Random(1,3)

    RULE;
    Move to: X:100, Y:100

    RULE:
    When X=100 & Y=100
    Move to X=300, Y:100

    RULE:
    When X=300 & Y=100
    Move to X:100, Y:100

    Wrap that in a bigger rule that when self.path = 1...

    Do that for self.path = 2, and self.path = 3
  • DrGlickertDrGlickert Member Posts: 1,135
    Oh, if they don't collide with anything, then I'd use interpolate instead of Move To.
  • DrGlickertDrGlickert Member Posts: 1,135
    tshirtbooth said:
    Rather then Move to i would use interpolate. Its much more reliable.

    cheers

    FREE GameSalad Videos and files at GShelper.com
    _________________________________________________________________________________

    PROJECT HELP WITH TSHIRTBOOTH.. CLICK HERE

    iDot GAME Template
    TRAJECTORY GAME Template
    5 Core controles Template
    Hit The Balls Template
    Rotating Menu VERY COOL Template
    STAR SMASHER Template
    Cut the Rope Style menu Template
    NEW Menu System #3 Template
    Missile Command Template
    Tiki Totem style template
    Labyrinth Template

    Very true, but what if they have collide rules on them? Interpolate wouldn't work then because interpolate can't be interupted...
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Use the line drawing demo by ORBZ and then add the waypoint logic (also by ORBZ) to each line segment. Or just have a line pen and a waypoint pen but make the waypoint pen invisible and make the waypoints inviisble. Just don't use constrain's in the waypoint (use change attributes instead).
  • DrGlickertDrGlickert Member Posts: 1,135
    tshirtbooth said:
    yes but if there are things to collide with then your way will also not work as if you tell the player to move to X:100, Y:100 and there is a wall in the way then it will never get there so the second rule would not take effect :)

    cheers

    I meant collides in the sense of bullets flying or tap-to-destroy type collides. Not walls. Should have been more specific ;-)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I used the method described above for this game:

    http://itunes.apple.com/us/app/fright-control-lite/id422673852?mt=8 (free version)
  • gambetgambet Member Posts: 38
    DrGlickert said:
    You'll have to use lots of rules, lots of exact numbers (in my opinion).

    Start with a self.attribute: self.path (integer type)
    Start the actor with a Change Attribute self.path to Random(1,3)

    RULE;
    Move to: X:100, Y:100

    RULE:
    When X=100 & Y=100
    Move to X=300, Y:100

    RULE:
    When X=300 & Y=100
    Move to X:100, Y:100

    Wrap that in a bigger rule that when self.path = 1...

    Do that for self.path = 2, and self.path = 3

    I've already did this with 9 control points, with to many rules but it works.
    The problem is that I need to spawn like 20 or more actors and this slows down my game (that's way i need another solution, will recycle actor instead of spawn help?).
    I will look at this fright control game and orbz demo and post again.

    PS. When I make move to, and then in rule if X=100 & Y=100, this doesn't work so I used the rule self.moving=false. Why the actor does not move to the move to coordinates
  • gambetgambet Member Posts: 38
    I don't mean that actor does not move at all, but the actor moves close to the coordinates, but not exactly on them
  • gambetgambet Member Posts: 38
    I have seen the orbz demo for waypoints, and now i remembered that I've used this for my ant actor, but this slows my game
    If I upload my solution will someone try to optimize the actor?
Sign In or Register to comment.