Sprites For Turing 4.x!
Author |
Message |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Sat Mar 06, 2004 3:41 pm Post subject: Sprites For Turing 4.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.
|
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Sat Mar 06, 2004 3:50 pm Post subject: (No subject) |
|
|
Every time i try to use sprites in turing 4.05 , it never works, even the examples in the reference don't work... why does this one? .. do you have to download the .tu file for it to work?
|
|
|
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Sat Mar 06, 2004 3:53 pm Post subject: (No subject) |
|
|
yes, beacue i made it all my self
u have to use my comands listed on that page.
Edit: why? b/c holth was dum and dan figgered out how to do it easly (well not that eassy but if u know what u are doing)
|
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Sat Mar 06, 2004 4:09 pm Post subject: (No subject) |
|
|
here is a program using your sprites, but it stops moving the sprite after a couple of keystrokes. i did it in like 10 minutes too.
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
var chars : array char of boolean
var change : int := 2
var x, y : int := 0
var pic : int := DanSprite.newPic (1, 1, "monkie.jpg")
%var pic2 : int := DanSprite.newPic (1, 1, "pic.jpg")
loop
View.Set ("offscreenonly")
View.Update
Input.KeyDown (chars)
delay (5)
if chars (KEY_UP_ARROW) then
y += change
DanSprite.movePic (x, y, pic)
end if
if chars (KEY_RIGHT_ARROW) then
x += change
DanSprite.movePic (x, y, pic)
end if
if chars (KEY_LEFT_ARROW) then
x -= change
DanSprite.movePic (x, y, pic)
end if
if chars (KEY_DOWN_ARROW) then
y -= change
DanSprite.movePic (x, y, pic)
end if
View.Update
end loop
|
EDIT : I took off the border boundaries
|
|
|
|
|
![](images/spacer.gif) |
rizzix
|
Posted: Sat Mar 06, 2004 4:26 pm Post subject: (No subject) |
|
|
hey i have my own fix for sprites in turing.. i'll post it here.. sry but the code is not documented, heh not time
here are the available functions for ur use.
code: |
Process-Safe global time slicing
--------------------------------
void BeginGlobalRuntime ();
void ResetGlobalRuntime ();
int GlobalTimeSlice ();
void EndGlobalRuntime ();
const GFX_ANIMATION, DEFAULT_ANIMATION, COMPLEX_ANIMATION
View.Update(Area) extensions
----------------------------
void GFXRadialRefresh (int x, int y, int radius);
void GFXPolyRefresh (int x1, int y1, int x2, int y2);
Animation drawing extensions
----------------------------
void GFXDrawRefreshPic (Picture pic, int x, int y);
void GFXDrawRefreshBox (int x1, int y1, int x2, int y2, Color colr);
void GFXDrawRefreshOval (int x, int y, int radiusx, int radiusy, Color colr);
Static drawing extensions
-------------------------
void GFXRestoreSnapshot (GFXSnapshot s);
void GFXDisposeSnapshot (GFXSnapshot s);
GFXSnapshot GFXTakeSnapshot (int x1, int y1, int x2, int y2);
GFXSnapshot GFXDrawStaticPic (Picture pic, int x, int y);
GFXSnapshot GFXDrawStaticOval (Picture pic, int x, int y);
GFXSnapshot GFXDrawStaticBox (Picture pic, int x, int y);
RGB extensions
--------------
Color RGBi (int r, int g, int b);
Color RGBr (real r, real g, real b);
|
NOTE: u need turing ver 4.0.5d++ for it to work
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
GFX.zip |
Filesize: |
1.92 KB |
Downloaded: |
268 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
rizzix
|
Posted: Sat Mar 06, 2004 4:29 pm Post subject: (No subject) |
|
|
here is an implementation of it using some old 2d motion description library of mine,, meh. i guess there's some use if it. heh.
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
ktest.zip |
Filesize: |
697.61 KB |
Downloaded: |
295 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Sat Mar 06, 2004 6:53 pm Post subject: (No subject) |
|
|
CompWiz333 wrote: here is a program using your sprites, but it stops moving the sprite after a couple of keystrokes. i did it in like 10 minutes too.
try this:
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
|
|
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Sat Mar 06, 2004 6:59 pm Post subject: (No subject) |
|
|
OMG that is Amazing!!! i used the monkey picture and it looks great! I think im gonna use this to make a kick a** program!!
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Sat Mar 06, 2004 7:08 pm Post subject: (No subject) |
|
|
i think the realy question is if i could make this in a day and rizzix made one two. why is it not inculded in turing? i mean if tom can't progame that well may be we should give him this code for his next update, lol
|
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
apomb
![](http://compsci.ca/v3/uploads/user_avatars/6489609347028a0f2422f.png)
|
Posted: Sat Mar 06, 2004 7:15 pm Post subject: (No subject) |
|
|
I would like to see you do that , quite thae challenge tho eh?
|
|
|
|
|
![](images/spacer.gif) |
recneps
![](http://www.fcpocanada.com/canada1.gif)
|
Posted: Sat Mar 06, 2004 8:55 pm Post subject: (No subject) |
|
|
Haha, i read source code post before this one and suggested the very thing you said Dan and nice Job. show em up! Ask them to pay for compsci hosting for your contributions!
|
|
|
|
|
![](images/spacer.gif) |
the_short1
|
Posted: Sat Mar 06, 2004 9:44 pm Post subject: (No subject) |
|
|
yea,,,, if we started to hand over some turorials and source in exchange for compsci being hostedby holtsoft.. and getting linked from holtsoft.. . that would rip..... hacker dan you should email tom..
|
|
|
|
|
![](images/spacer.gif) |
Dan
![](http://wiki.compsci.ca/images/archive/3/3c/20100325043407!Danspic.gif)
|
Posted: Sat Mar 06, 2004 9:52 pm Post subject: (No subject) |
|
|
ya i should, lol. we are all ready liked from them tho :p on there hard to find turing likes page.
also i found a small bug in my sprite code, if u are 1/2 on the scrren and 1/2 off with a sprite and another one hits it while both are moving it can mess the back gorund a bit.
i am curlty fixing this and will post a better verson some time soon.
|
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
![](images/spacer.gif) |
|
|