Week 9 - Some Short Demos

 

1) Drawing on the stage without generating a sprite: (example)

 

on exitFrame me


    point_1 = point(20,20)
    point_2 = point(60, 40)
    point_3 = point(160, 220)


    --when drawing lines you can use points - but you don't have to
    (the stage).image.draw(point_1,point_2,[#shapetype:#line,#color:rgb(255,102,0)])
    (the stage).image.draw(point_2,point_3,[#shapetype:#line,#color:rgb(255,102,0)])

    -- here, we're drawing an oval and a rectangle
    (the stage).image.draw(0, 0, 128, 86,[#shapeType:#oval, #lineSize:1,#color: rgb(150, 0, 0)])
    (the stage).image.draw(100, 100, 300, 200,[#shapeType:#rect, #lineSize:1,#color: rgb(150, 0, 0)])

    --you can also make filled shapes. if you want to draw onto those shapes, you have to first draw the filled shape and then the rest
    (the stage).image.fill(rect(30,40,90,50),[#shapeType: #rect, #color: rgb("0000FF")])
    (the stage).image.draw(30,40,90,50,[#shapeType: #rect, #color: rgb("FF0000")])

end

 

4) MIAWs (Movies In A Window)

If you want to have several director movies playing at the same time, you can use MIAWs.
The MIAW Xtra (included in Director) enables Director to open other director movies in windows other than itself.
MIAWs can for example be used if you want to create a pop-up window containing another movie.

The following code opens and closes a MIAW example

global win

on mouseUp me

    win=window("miaw2")

    -- this is where you tell director the file name
    win.filename="miaw2"
    win.open()
    win.rect= rect(0,0,300,100)

end

-----------

if you want to close a miaw:

global win

on mouseUp me
    close(win)
    forget(win)
end

-------

if you want to remove the title bar

window("hello world").windowType = 1

 

MIAWs are great and there is a lot of info on them in Director Help (how to make custom dialog boxes, how they can communicate with eachother etc.)

 

3) Jeff's Joystick Example

Download it from here:

http://34n118w.net/145A/Annina/

Basically, what you need to do is download the "transfer.cst".
This is a cast consisting of just one script.
Import the cast and drag the script onto the sprite you want to move.
This did not work when i used it with my joystick but maybe it works for you.

 

r.cst".