
-----------------------------------
Dan
Sat Mar 06, 2004 3:42 pm

Using Sprites in turing 4.0.x
-----------------------------------
Check out this thing i made here:

http://www.compsci.ca/mx/index.php?page=58 


you may need to know how to import unit files to get it working. If you guys rember what Sprites where u may find this cool. For thous who do not, they are like pics but when u move them they dont deleleat the backgorup so it makes animation easer and better b/c you dont have to redraw the back gorund every few seconds.

I got a doc on there on how to uses them to so that may help explaine it a bit.

-----------------------------------
Dan
Sat Mar 06, 2004 7:05 pm


-----------------------------------
Another EX code:


import "DanSprite.tu"

setscreen ("graphics:max;max,nobuttonbar")
setscreen ("offscreenonly")


for i : 1 .. maxx by 5
    Draw.Line (i, 0, i, maxy, 3)
end for

for ii : 1 .. maxy by 5
    Draw.Line (maxx, ii, 0, ii, 4)
end for

for iii : 1 .. maxcolor
    Draw.FillOval (maxx div 2, maxy div 2, maxcolor - iii, maxcolor - iii, iii)
end for


procedure flush
    var ch : string (1)
    loop
        exit when not hasch
        getch (ch)
    end loop
end flush


var chars : array char of boolean
var x, y := 1

var pic : int := DanSprite.newPic (1, 1, "pic.jpg")
DanSprite.setMode(pic,DanSprite.MERGE)

loop
    if Input.hasch then
        Input.KeyDown (chars)
        if chars (KEY_UP_ARROW) then
            y += 10
        end if
        if chars (KEY_RIGHT_ARROW) then
            x += 10
        end if
        if chars (KEY_LEFT_ARROW) then
            x -= 10
        end if
        if chars (KEY_DOWN_ARROW) then
            y -= 10
        end if
        DanSprite.movePic (x, y, pic)
        View.Update
        flush ()
    end if

end loop


-----------------------------------
recneps
Sat Mar 06, 2004 8:49 pm


-----------------------------------
Nice Dan, you should submit that to Holtsoft! haha. If you werent admin/mod id give you ALL ME BITS! :D

-----------------------------------
Omicron91
Mon Dec 20, 2004 5:55 pm


-----------------------------------
Dan, can I have your children? Well, technically not, but if I were a woman I'd be all over you. DanSprite saved my RPG :D!

-----------------------------------
Bacchus
Sun Feb 06, 2005 12:54 am


-----------------------------------
nice work, but i found a bug easy to fix thoug. in chagePic (i love the name too :P) it has an error, you just forgot to put in the picture id (only inputs the number
procedure chagePic (x : int, y : int, fileName : string, picID : int)
        assert picID > 0 and picID 