Jumping Bug: Difference between revisions
(Created page with "=Chapter 5 - Jumping= if you've ever tried using the '''JumpTo''' class, you may have found it doesn't work very well. This is because there are bugs in the template game tha...") |
m (1 revision imported) |
(No difference)
|
Revision as of 00:07, 3 June 2024
Chapter 5 - Jumping
if you've ever tried using the JumpTo class, you may have found it doesn't work very well. This is because there are bugs in the template game that comes with SCI Studio. Using Brian's disassembler, I looked at the Space Quest 3 scripts to see what the code was really supposed to do. With these fixes, you can make the ego jump to a particular screen location.
Fixing Jump.sc
Open the Jump.sc script, and make the following changes.
Replace the setTest method with this:
Code:(method (setTest) (if (> (send client:x) x) (= dx -1) )(else (if (<> x (send client:x)) (= dx 1) )(else (if (> xStep 0) (= dx -1) )(else (= dx 1) ) ) ) (if (> (send client:y) y) (= dy -1) )(else (if (<> y (send client:y)) (= dy 1) )(else (if (> yStep 0) (= dy -1) )(else (= dy 1) ) ) ) )
Then go to the doit method. There is an 'x' where there should be a 'y'. Replace this code:
Old code:
Code:(send client: x(+ xLast xStep) x(+ yLast yStep) )
With this:
Fixed code:
Code:(send client: x(+ xLast xStep) y(+ yLast yStep) )
Finally, the moveDone method of the Jump class is missing a (self:motionCue()). It should look like this:
Fixed code:
Code:(method (moveDone) (send client: illegalBits(illegalBits) signal(signal) ) = completed TRUE (if(caller) = gCastMotionCue TRUE )(else (self:motionCue()) ) )
With these changes, jumping should work properly. Just add (use 'Jump')to the top of your script, and then use the JumpTo class:
Example:
Code:// Make the ego jump to 100,100 (send gEgo:setMotion(JumpTo 100 100))
< Previous: Chapter 4 - Loopers Next: Chapter 6 - The z-coordinate >