Author Topic: How to use multi-directional views in your games  (Read 667 times)

0 Members and 1 Guest are viewing this topic.

Offline Robert Eric

How to use multi-directional views in your games
« on: December 05, 2003, 12:30:15 AM »
In the cycle.sc file, go to (class Motion of Obj and you should find DirLoop there sitting all by itself.  Remove that, and add something like this:

Code: [Select]
           (if ((== (send client:heading) 0) or (== (send client:heading) 360))
                (send client:loop(3))
            )
            (if (== (send client:heading) 90)
                (send client:loop(0))
            )
            (if (== (send client:heading) 180)
                (send client:loop(2))
            )
            (if (== (send client:heading) 270)
                (send client:loop(1))
            )
            (if (== (send client:heading) 135)
                (send client:loop(4))
            )
            (if (== (send client:heading) 225)
                (send client:loop(5))
            )
            (if (== (send client:heading) 45)
                (send client:loop(6))
            )
            (if (== (send client:heading) 315)
                (send client:loop(7))
            )

What this does, is takes the heading property from the referred object and test it against the 8 angles, 45, 90, 135,180, 225, 270, 315, and 360.  0 and 360 will both equal up.  I used a view from Codename: Iceman to test this out, so use your own loop numbers, if they're different.

P.S. Excuse me if this has already been covered.



Offline Robert Eric

Re:How to use multi-directional views in your games
« Reply #1 on: December 05, 2003, 12:32:52 AM »
Hm, at the moment, if you click somewhere to move the Ego, it will not use the right loop.  I haven't the time at the moment, so if anyone can tidy that flaw up for me, please do.  Thanks.  If no one has by the time I get back, I'll do it.

Offline Brian Provinciano

Re:How to use multi-directional views in your games
« Reply #2 on: December 05, 2003, 03:56:16 PM »
You can't do "== 90" and "==180". What about 91 and 179? You need to change it to a >= && <= expression to cover ALL degrees.

Offline Robert Eric

Re:How to use multi-directional views in your games
« Reply #3 on: December 05, 2003, 05:33:43 PM »
Why?  The heading/angle property is never set to anything between those values.  Add this to rm001.sc and see:

Code: [Select]
 (if(Said('run'))
    FormatPrint("%d" (send gEgo:heading))
  )

Offline Brian Provinciano

Re:How to use multi-directional views in your games
« Reply #4 on: December 06, 2003, 03:53:27 AM »
Maybe..but it's good to be safe regardless. There's nothing on the other hand that I can remeber that would prevent it from being the odd values either. I did write the entire template game scripts, though don't remember completely how they work off the top of my head.

Offline Robert Eric

Re:How to use multi-directional views in your games
« Reply #5 on: December 06, 2003, 01:14:17 PM »
Oh, wait...are you Brian?  I didn't recognize you since you're not using your member name.  Sorry about that.  I now have my script checking for the in between values...why didn't you tell me you were...you?  I wouldn't have questioned you, but done anything to the script you wanted me to @_@

Offline Brian Provinciano

Re:How to use multi-directional views in your games
« Reply #6 on: December 06, 2003, 05:32:28 PM »
It's fine to question my comments :) I wrote the template code closer to two years ago, and am not currently scripting any SCI games of my own, so I might forget things here and there. However, just as a general thought because of mouse use (of course keyboard/joystick movement would always be on even angles), it should be possible for the views to move at diffent angles other than those. When you click the mouse the angle should very rarely be on those exact angles because you wouldn't usually be clicking on exactly 90degrees from the ego for example.

Offline Robert Eric

Re:How to use multi-directional views in your games
« Reply #7 on: December 06, 2003, 06:29:33 PM »
Sorry, you were right.  I was only checking the angle after I pressed up, right, page up etc. and not with mouse clicks.

Offline Cloudee1

Re:How to use multi-directional views in your games
« Reply #8 on: February 05, 2004, 08:38:54 AM »
Hey Bob, Brian, or anyone else who might know,

I've fooled around with this a little bit and so far I can't get it to work correctly.

Actually what I am trying to do is not add new loops but rather realign the current four, instead of having north, south, east, and west, I want the diagonals to be the primary directions.

I tried replacing this in cycle script:
Code: [Select]
(else
   DirLoop(client (send client:heading))
 )
With this:
Code: [Select]
(else
  (if((>=(send client:heading)1) & (<=(send client:heading) 90))(send client:loop(2)))
  (if((>=(send client:heading)91) & (<=(send client:heading) 179))(send client:loop(3)))
  (if((>=(send client:heading)180) & (<=(send client:heading) 269))(send client:loop(1)))
  (if((>=(send client:heading)270) & (<=(send client:heading) 360))(send client:loop(0)))
 )
but ego does not change loops when direction changes
« Last Edit: February 29, 2004, 06:16:58 AM by cloudee1 »
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline Cloudee1

Re:How to use multi-directional views in your games
« Reply #9 on: February 06, 2004, 01:38:35 PM »
Uhm yeah,

well does anybody have any suggestions, I edited my previous post to include the script I am trying to work.

Ego starts in whatever loop I initialize it in but as soon as I move it goes to loop 0 and stays there.

Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition

Offline Cloudee1

Re:How to use multi-directional views in your games
« Reply #10 on: February 09, 2004, 04:52:02 AM »
Anyone?  ???
Halloween Competition Brass Lantern Prop Competition Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.067 seconds with 22 queries.