Cyber Syndicate
<center><p style='font-size:120%;'><strong>Welcome to Cyber Syndicate!<strong></p>

You are visiting as a guest; please <strong>register</strong> or <strong>log in</strong>.

Being logged in provides many benefits, including access to the useful <strong>Methods forum</strong>, posting permissions, and voting permissions.

<strong>Enjoy.</strong></center>



 
HomeFAQUsergroupsRegisterLog in

Share
 

 °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°

Go down 
AuthorMessage
Ramus
VIP
VIP


Posts : 41
Join date : 2011-02-27
Age : 23
Location : Wales

°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Empty
PostSubject: °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°    °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Icon_minitimeSat Mar 12, 2011 11:33 am

°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°



°.¸¸.•´¯`»★мαкιηg α ραтн★«´¯`•.¸¸.°


To make a path, I would recommend using my ToolKit. Click here to add to RSBuddy.



°.¸¸.•´¯`»★∂є¢ℓαяιηg уσυя ραтн★«´¯`•.¸¸.°


To declare your path variable you should use a code similar to this:
Code:
Tile[] TILES = { new Tile(9999, 9998), new Tile(9997, 9996), new Tile(9995, 9994) };
TilePath path = Walking.newTilePath(TILES);


What does this do?


Code:
Tile[] TILES = { new Tile(9999, 9998), new Tile(9997, 9996), new Tile(9995, 9994) };
This is an array of tiles starting with the tile '9999, 9998', ending with the tile '9995, 9994' and including the Tile'9997, 9996'.


Code:
TilePath path = Walking.newTilePath(TILES);
This will make a walkable path using your tile array.



°.¸¸.•´¯`»★єχтяα тιℓєѕ★«´¯`•.¸¸.°


These are a few tiles that will help you:
Code:
path.getStart();
path.getNext();
path.getEnd();


What do these tile return?


Code:
path.getStart();
This will return the start/first tile of your path. In this case it's '9999, 9998'.


Code:
path.getNext();
This will return the next tile to walk. For example if we are at the start of the path, it will return '9997, 9996'.


Code:
path.getEnd();
This will return the end/last tile of your path. In this case it's '9995, 9994'.



°.¸¸.•´¯`»★ωαℓкιηg уσυя ραтн★«´¯`•.¸¸.°


To walk your path use the following code:
Code:
path.traverse();


If you wish to reverse the path, then walk the reversed path use the following code:
Code:
path.reverse().traverse();


If you wish to randomize the path, then walk the randomized path use the following code:
Code:
path.randomize(3, 3).traverse();
This will randomize the path by a radius of 3 tiles.


if you wish to reverse and randomize the path, then walk it, use the following code:
Code:
path.reverse().randomize(3, 3).traverse();


Note: Using reversed paths:

To un-reverse it you will have to do one of the following:

- Reverse it again (See example 1).
- Reinitialize it (See example 2).


Example 1:

Reverse it:
Code:
path.reverse();


Un-reverse it:
Code:
path.reverse();


Example 2:

Code:
path = Walking.newTilePath(TILES);



°.¸¸.•´¯`»★gєηєяαтιηg α ραтн υѕιηg σηє тιℓє★«´¯`•.¸¸.°


To generate a path, firstly you will need a destination tile. For example:
Code:
Tile DEST = new Tile(9999, 9998);


To walk to this tile you will have to declare a new path:
Code:
Path path = Walking.findPath(DEST);
This will generate a path to the DEST tile.

To walk it simply use the same methods as shown above.


Here is another method like the one above but much, much simpler:
Code:
Walking.stepTowards(DEST);
This will also generate a path to the DEST tile, but will also walk 1 tile towards the DEST tile. To walk the whole path, you will have to loop this method. For example:

Code:
while (Calculations.distanceTo(DEST) > 5) {
    Walking.stepTowards(DEST);
}

________________________________
°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Svlatc


Last edited by Ramus on Sun Mar 13, 2011 1:57 am; edited 3 times in total
Back to top Go down
View user profile
b0xb0x
Administrator
Administrator


Posts : 130
Join date : 2011-02-25
Age : 23
Location : California

°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Empty
PostSubject: Re: °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°    °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Icon_minitimeSat Mar 12, 2011 12:05 pm

<3 Very Happy
Back to top Go down
View user profile http://cybersyndicate.forumotion.com
Remo
Member
Member


Posts : 41
Join date : 2011-03-10

°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Empty
PostSubject: Re: °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°    °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Icon_minitimeSat Mar 12, 2011 12:34 pm

And... you just fucking owned my tutorial.
Back to top Go down
View user profile
Ramus
VIP
VIP


Posts : 41
Join date : 2011-02-27
Age : 23
Location : Wales

°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Empty
PostSubject: Re: °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°    °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Icon_minitimeSat Mar 12, 2011 12:44 pm

b0xb0x wrote:
<3 Very Happy
<3 You asked for it Very Happy

Remo wrote:
And... you just fucking owned my tutorial.
You made a tutorial on walking aswell?

________________________________
°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Svlatc
Back to top Go down
View user profile
Remo
Member
Member


Posts : 41
Join date : 2011-03-10

°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Empty
PostSubject: Re: °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°    °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Icon_minitimeSat Mar 12, 2011 12:50 pm

Ramus wrote:
b0xb0x wrote:
<3 Very Happy
<3 You asked for it Very Happy

Remo wrote:
And... you just fucking owned my tutorial.
You made a tutorial on walking aswell?

A miniature one. I wrote it in Methods because I was listing some useful methods that newbs should learn.
Back to top Go down
View user profile
Ramus
VIP
VIP


Posts : 41
Join date : 2011-02-27
Age : 23
Location : Wales

°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Empty
PostSubject: Re: °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°    °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Icon_minitimeSat Mar 12, 2011 12:57 pm

Remo wrote:
Ramus wrote:
b0xb0x wrote:
<3 Very Happy
<3 You asked for it Very Happy

Remo wrote:
And... you just fucking owned my tutorial.
You made a tutorial on walking aswell?

A miniature one. I wrote it in Methods because I was listing some useful methods that newbs should learn.

Ah yea, shouldn't it be in the tutorials section though?

________________________________
°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Svlatc
Back to top Go down
View user profile
Sponsored content




°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Empty
PostSubject: Re: °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°    °.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°  Icon_minitime

Back to top Go down
 
°.¸¸.•´¯`»★ωαℓкιηg тυтσяιαℓ★«´¯`•.¸¸.°
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Cyber Syndicate :: Development :: Tutorials-
Jump to: