Author Topic: Simple programming question  (Read 6028 times)

0 Members and 1 Guest are viewing this topic.

Joe

  • Guest
Simple programming question
« on: July 26, 2002, 03:12:45 PM »
Why does the compiler give errors to:

(if(aMan:isStopped() and not aMan:isBlocked())

But not to:

(if((aMan:isStopped()) and not (aMan:isBlocked()))

Is it the same reason as why C compilers expect something like:

if ((bla == 5) || (bloo != 0)) {

?



Offline Brian Provinciano

Re:Simple programming question
« Reply #1 on: July 26, 2002, 04:38:22 PM »
Send operations always require full brackets, not just in ifs. This is because they can take multiple params.

ie.
 (send gEgo:
     setSpeed(123)
     setSomethingElse()
     setThat(345)
 )

so if you're sending just one param, it still works the same:

   (aMan:
       isStopped()
   )

or

   (aMan:isStopped())

Joe

  • Guest
Re:Simple programming question
« Reply #2 on: July 26, 2002, 05:46:10 PM »
I'm going to just ask another question here to save space.  What does 'angle' do?

Offline Brian Provinciano

Re:Simple programming question
« Reply #3 on: July 26, 2002, 08:07:22 PM »
There is no "Angle" kernel or method. "GetAngle" takes two points and returns the angle of them.

Joe

  • Guest
Re:Simple programming question
« Reply #4 on: July 27, 2002, 04:40:16 AM »
No, it's a global variable.

gPicAngle

Offline Brian Provinciano

Re:Simple programming question
« Reply #5 on: July 27, 2002, 05:03:52 PM »
"angle" isn't a global variable either, hehe
   
gPicAngle is used to obtain the distance between two objects using the GetDistance() kernel. With gPicAngle, the GetDistance kernel operates like this:
   
disance = squareroot( (x1-x2)/ cosine(gPicAngle*3.14/180)) * (y1-y2) )


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

Page created in 0.05 seconds with 20 queries.