palito-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[palito-dev] new commander take 2


From: Michael Devey
Subject: [palito-dev] new commander take 2
Date: Tue, 30 Sep 2003 21:10:07 +1000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030319 Debian/1.3-3

hey look! itsa new commander, everyone loves a new commander!
new and improved with new, old strobe lights.

Use him, he may look more complicated but he actually draws faster, trust my insanity.

one day I'll sneak this in,

myke
# Hi, I'll be your commander today :)
{
Normally I would be the first unit you see, I'm also a good example of 
what can be achieved through use of the flush drawing language for 
palito.

For full documentation of the language look elsewhere, but since you 
just disregarded what I said - here's a crash course.
}
# comments or code that will not be interpreted
{
large blocks not to be interpreted are encapuslated in braces like so.
}
{
MATHEMATICS
= $variable 10            --> variable = 10
= $phaseA sin + $walk pi  --> phaseA   = sin (walk + 3.14)

so everything is expressed as operation var1 var2
where (var1) may infact be (operation varx  vary)

You can define your own psuedo functions - inputs and outputs must be 
variables already defined.

function xplusone
        = $x + $x 1
end

which can be called with "call xplusone" 
notice x is not passed and returned but merely changed globally.

BUT MOST IMPORTANTLY many functions have already been defined, including 
the all important drawing functions.

line2d 0 0 4 5  --> draw a line from (0,0) to (4,5) 
cirle2d 1 2 3   --> circle based at (1,2) with a radius 3
box2d 0 0 1 9   --> rectangle with corners (0,0) (1,0) (0,9) (1,9)

note:   * the origin is the middle of the unit on screen
        * by defualt enclosed shapes are colour filled 
          (change with hollow 1)
        * parser.c list's MANY more functions
        * highlights: time, polyline, if/then/else, color!
        * copying segments out of other units is a quick way to learn 
        * it looks scary, but really, it's super simple
}

#################################
# THE COMMANDER, already damnit #
#################################
# arms and feet movement (left arm, right arm, left foot, right foot)
# out of phase by 180' (pi)
# arms move 2 units centered on x=2.3 (1.3-3.3)
# feet move 1 units centered on x=2.0 (1.5-2.5)
= $phaseA sin + $walk pi
= $phaseB sin $walk
= $la + 2.3 $phaseA
= $ra + 2.3 $phaseB
= $lf + 2 / $phaseB 2
= $rf + 2 / $phaseA 2

# shoot weapon out of right arm
= $weapon_x $ra
= $weapon_y -3

# coutour outline & colorfill (more efficient if done all at once)
if > $nano 0
        polyline  -1.5 -2  -1.5 2  -1 2  -1 4  1 4  1 3.5
                  $la 3.5  $la 2.5  1 2.5  1 2  1.5 2  1.5 1.5
                  $lf 1.5  $lf 0.5  1.5 0.5  1.5 -0.5  $rf -0.5  $rf -1.5
                  1.5 -1.5  1.5 -2  1 -2  1 -2.5
                  $ra -2.5  $ra -3.5  1 -3.5  1 -4  -1 -4  -1 -2
        close
        circle2d -2.5  1 1
        circle2d -2.5 -1 1
end

#following shapes have no colorfill - only outlines
hollow 1

#head
circle2d 0 0 1

# strobing tubes on back
push translate -2.5 0
        = $c fold / time 100 1
        push scale $c $c
                circle2d 0  1 1
                circle2d 0 -1 1
        pop
pop

# chest/feet boundary (1 line instead of 2)
line2d 1.5 1.5 1.5 -1.5 

#arms/shoulder boundary (3 triangles for shoulder)
polyline -1  4 0  2 1  4 1  2 -1  2 end
polyline -1 -4 0 -2 1 -4 1 -2 -1 -2 end

reply via email to

[Prev in Thread] Current Thread [Next in Thread]