rects, lists & points


[ Zettels Traum ] [ search / suche ]

von dp am 06.Juli 97 um 16:21:07:

>
>Furthermore, internally types like points and rects are also represented as
>linear lists, so you can use the same tricks here to:
>
>put point(2,3) + point(5,4)
>-- point(7,7)
>put rect(1,2,3,4) + 1
>-- rect(2,3,4,5)


Some more playing around with rects, lists and points.

set r=rect(10,11,12,13)
put the left of r
-- 10
put the top of r
-- 11
put the right of r
-- 12
put the bottom of r
-- 13
put the height of r
-- 2
put the width of r
-- 2

do the same with theList=[10,11,12,13] and the property 's not defined.
Hmm.

put theList+r
-- [20, 22, 24, 26]
put r + theList
-- rect(20, 22, 24, 26)

set toRect=rect(0,0,0,0)
set toList=list(0,0,0,0)

put the left of (torect+theList)
-- 10
put the width of (torect+theList)
-- 2

You can change points to lists and lists to points in a similar way:

put p
-- point(3, 6)
put l
-- [0, 0]
put l+p
-- [3, 6]
put p+l
-- point(3, 6)

----------------------------------------

You can jiggle the loc of a sprite by combining it with the state of
rollover(n), if somewhere the sprite has been properly puppetted, its
original loc = point(x,y) stored in a variable/property called origLoc, and
an offset value is set.


set the loc of sprite spriteNum = origLoc + rollover(spriteNum)
* point( hOffset, vOffset)
updateStage

i.e of rollover returns 0 then the loc is not changed, if it is, it is
offset by the values in the point list. It's just a multiplication
distributed over a list using the boolean value of a function ( rollover(),
could easily be another function that returns an integer, i.e. a
user-defined function beenThereBefore() )

-------------------



Dazu:























D. Plänitz