Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
Sign in to follow this  
avarisclari

Scripting Idea

Question

I have an idea for a script, I know the basics of how it would work, but there is one part im struggling with. Basically its a "rotation" script, push this button and the map will rotate 90 degrees. I'd implement a graphic change for the character at 45 degrees and teleport to each map, but the part i dont understand is how to make him be on the relevant tile from wherever the button is pressed without thousands of events on the maps. Anyone mind helping me out?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I have no clue what you mean by the rotating business, but if you want to teleport a player to the same x and y he was in the last map, just retain those to values, and a third for the map id, in three variables.

 

Those can then be used as parameters for the teleport.

Share this post


Link to post
Share on other sites
  • 0

Okay, so if I understand correctly...you are using 4 maps, each as one 90 degree rotation, and are not sure how to retain the same relative tile rather than the same x, y?

 

Instead of looking at the character having just x and y coordinates, think of there being 4 distances between the character and the furthest tile on each 4 sides.

 

 

#tiles from left (x)

#tiles from top (y)

#tiles from right

#tiles from bottom

 

so, when the map rotates, in order for everything to maintain the same relative location, all 4 of these values will need to rotate in the same direction.

 

So, when you rotate the map clockwise:

#tiles from bottom become #tiles from left

#tiles from left become #tiles from top

#tiles from top become #tiles from right

#tiles from right become #tiles from bottom

 

Counter clockwise:

#bottom > #right

#right > #top

#top > #left

#left > #bottom

 

So, to make this fact practical:

 

clockwise:

 

new x = map height - old y

new y = old x

 

counter clockwise:

 

new x = old y

new y = map width - old x

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...