Computer Science Canada

Using Sprites in turing 4.0.x

Author:  Dan [ Sat Mar 06, 2004 3:42 pm ]
Post subject:  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.

Author:  Dan [ Sat Mar 06, 2004 7:05 pm ]
Post subject: 

Another EX code:

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

Author:  recneps [ Sat Mar 06, 2004 8:49 pm ]
Post subject: 

Nice Dan, you should submit that to Holtsoft! haha. If you werent admin/mod id give you ALL ME BITS! Very Happy

Author:  Omicron91 [ Mon Dec 20, 2004 5:55 pm ]
Post subject: 

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 Very Happy!

Author:  Bacchus [ Sun Feb 06, 2005 12:54 am ]
Post subject: 

nice work, but i found a bug easy to fix thoug. in chagePic (i love the name too Razz) it has an error, you just forgot to put in the picture id (only inputs the number
code:
procedure chagePic (x : int, y : int, fileName : string, picID : int)
        assert picID > 0 and picID <= num     %if u get error: bad pic id
        Pic.Draw (temp (picID), oldx (picID), oldy (picID), picCopy)

        Pic.Free (pic(picID))  %<-- was originally just Pic.Free(picID)

Author:  blaster0 [ Sun Jun 26, 2005 10:07 pm ]
Post subject:  Sprites

I'm sorry for sounding so ignorant but is there a away to very easily using commands such as sprite.new and sprite.animate make a working sprite. And if so can you explain my turing help isn't doing to much for me.

Author:  Cervantes [ Mon Jun 27, 2005 7:44 am ]
Post subject: 

The sprite commands in Turing 4.x have been disabled. Are you asking for help as to how to use them, or how to use DanSprite? Also, Bacchus made a BacchusSprite that you may wish to check out as well.

Author:  Spartan_117 [ Tue Jul 19, 2005 11:32 am ]
Post subject: 

Arent sprites moving images? like for example a walking mario? those are gifs tho, how do u import thos when Turing doesnt allow that.

Author:  MysticVegeta [ Tue Jul 19, 2005 12:21 pm ]
Post subject: 

why do you think he made it then lol Laughing

Author:  Spartan_117 [ Tue Jul 19, 2005 5:37 pm ]
Post subject: 

but in his example we only import one picture.... i kinda forgot turing so maybe im missing something,

Author:  [Gandalf] [ Tue Jul 19, 2005 6:16 pm ]
Post subject: 

Yes, but the point is that he takes that picture and animate it using Turing. A .gif is already pre-animated, and you need some program to edit it. Using this you can animate it however you want in Turing, and use it in either a game or animation or whatever you can think of.

Author:  Delos [ Tue Jul 19, 2005 8:06 pm ]
Post subject: 

Generally speaking, .gifs are indeed a series of single-frame pictures put together in a format that displays them alternatively with a certain, set delay between each picture. For instance, my avatar is actually a large picture spliced up and turned into a .gif using 3 frames.
Hence, having only one picture imported by the module is not a problem, as you would be able to import a series of such pictures, string them together, and voilà, you have your animation.

Author:  MysticVegeta [ Wed Jul 20, 2005 8:38 am ]
Post subject: 

Make it play 35 fps and you have tv speed animation lol

Author:  The Unknown [ Sat Dec 17, 2005 9:00 pm ]
Post subject: 

Um, I can't check out the initial link. This error message pops up:

General Error

Could not query modules information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mod WHERE blk.function_id = fnc.function_id AND blk.block_id = bct.' at line 5

SELECT blk.block_id, bct.column_id, module_path, function_file, auth_view FROM mx_column_block bct, mx_block blk, mx_function fnc, mx_module mod WHERE blk.function_id = fnc.function_id AND blk.block_id = bct.block_id AND fnc.module_id = mod.module_id ORDER BY column_id, block_order

Line : 103
File : /home/.angela/hackerdan/compsci.ca/mx/index.php


can anyone help me here (keep in mind that I do not know what the hell that message is saying Crying or Very sad )?

Author:  [Gandalf] [ Sat Dec 17, 2005 9:03 pm ]
Post subject: 

The link is broken because of the change in hosts of compsci, but not everything is still hosted...

You can find a different, probably better version made by Bacchus here:
http://www.compsci.ca/v2/viewtopic.php?t=8108

Author:  The Unknown [ Sun Dec 18, 2005 12:00 pm ]
Post subject: 

Thanks man. Very Happy


: