JazzJackrabbit Community Forums

JazzJackrabbit Community Forums (http://www.jazz2online.com/jcf/index.php)
-   JCS & Scripting (http://www.jazz2online.com/jcf/forumdisplay.php?f=5)
-   -   ow do i make sucker tubes (http://www.jazz2online.com/jcf/showthread.php?t=18954)

JnAkers Nov 6, 2010 12:03 PM

ow do i make sucker tubes
 
I edit the x speed values and y values to negative yet they still shoot them right or up.

DodgeS Nov 6, 2010 12:17 PM

No way!

LegendaryDreamer Nov 6, 2010 12:52 PM

I think the problem is that you think positive values make the player go right and up.

X
Positive = right
Negative = left

Y
Positive = down
Negative = up

Edit: updated

Violet CLM Nov 6, 2010 01:29 PM

Quote:

Originally Posted by LegendaryDreamer (Post 463384)
X
Positive = left
Negative = right

Incorrect.
Quote:

Y
Positive = down
Negative = up
Correct.

LegendaryDreamer Nov 6, 2010 01:48 PM

I updated it (epic fail on my part, sorry ;p)

Grytolle Nov 6, 2010 02:44 PM

what happens if you set a y-value and an x-value?

EvilMike Nov 6, 2010 02:52 PM

At low speeds you get stuck. At higher speeds, you'll move diagonally.

Violet CLM Nov 6, 2010 04:45 PM

empirical results and new hypothesis
 
Actually, you only get stuck if there's a small (meaning between -15 and 16 inclusive) x-speed and a non-zero y-speed. As long as the x-speed is large (-16 or lower, or 17 or higher), it doesn't matter what y-speed you have. To take a guess at why this works, in pseudo-code:
Code:

z = player.current_zone
if z.class = sucker_tube {
    if z.yspeed {
        player.xpos = z.xpos
        player.yspeed = z.yspeed
    } if z.xspeed {
        player.ypos = z.ypos
        player.xspeed = z.xspeed
    }
}

This isn't quite right, because it's not just a matter of setting the player y-position, there's also some sort of temporary nullification of y-speed (an upward diagonal tube sends you not quite as high as an upward non-diagonal tube, meaning that the first movement caused by the y-speed fails to take place, but the y-speed created by the tube is maintained even through the x-speed check), but I think it's along the right lines.

Toni Nov 7, 2010 06:55 AM

so,

X:
Positive = Right
Negative = Left

Y:
Positive = Down
Negative = Up

XY:
Both positive(slow) = (probably) stuck
Both positive(fast) = move diagonal down and right. How much diagonal, depends on X and Y parameters
Both negative(slow) = (probably) stuck
Both negative(fast) = move diagonal up and left. How much diagonal, depends on X and Y parameters
Y positive, X negative = move diagonal down and left. How much diagonal, depends on X and Y parameters
Y negative, X positive = move diagonal up and right. How much diagonal, depends on X and Y parameters

Violet CLM Nov 7, 2010 10:30 AM

Quote:

Originally Posted by Toni (Post 463428)
Y positive, X negative = move diagonal down and left. How much diagonal, depends on X and Y parameters

iff X < -15.
Quote:

Y negative, X positive = move diagonal up and right. How much diagonal, depends on X and Y parameters
iff X > 16.

JnAkers Nov 7, 2010 11:17 PM

Wow guys thanks alot. learned quite a bit!

Toni Nov 8, 2010 05:49 AM

No problem. Try to learn a lot of more in JCSing :)


All times are GMT -8. The time now is 10:34 AM.

Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
JCF © 2001-Infinity Jazz2Online