Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Sprites...

Author
Message
TGWDNGHN
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 5th Oct 2002 04:44
I really don't get the Get Image command...I kinda understand how it works but How can i define a sprite? How can I handle the manipulation of many sprites in lets say a 2D platform game? can someone expalin me this?
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 6th Oct 2002 15:21
The get image command will 'catch' a certain part of the screen and make an image out of it. Say, if you were making a test pogram where a blue matrix is created but you didn't want to supply a .bmp file with you code, you would have:

rem clear the screen to give a blank working palette
cls

rem now set our ink colour
ink rgb(0,0,255),0

rem now put a box on the screen
box 0,0,128,128

rem now use GET IMAGE to "grab" this box and make an image
rem syntax: GET IMAGE Image Number, Left, Top, Right, Bottom
get image 1,0,0,128,128

rem now we have image 1, which is a blue box.


People can develop this sort of code further to create random textures, etc.

Now, a sprite. It is like a "frige magnet". You don't have to paint it onto the background, then clear the screen and repaint it again, etc.

With a sprite you just givit in an image number and where on the screen it should go. For example, to make a sprite (#1), made of image #99 and the screen at 10,10 type:

sprite 1,10,10,99

Now let's append our above code with some code that will position sprite 1 at the mouse course. Let's make sprite 1 image 1 we grabbed earlier by using GET IMAGE.

(insert below code)

rem set up a loop, so these actions keep happening


rem clear the screen
cls

do

rem place a sprite
sprite 1,mousex(),mousey(),1

rem sync
sync

loop


So, this is what the finished code looks like:




I love Star Trek.
Especially the Episodes with Starships in.
TGWDNGHN
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 6th Oct 2002 18:05
so like...the image number in the get image command is the iamge created? thats basicly my problem...

David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 6th Oct 2002 21:09
Yes.

I love Star Trek.
Especially the Episodes with Starships in.
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 6th Oct 2002 21:26
This example shows using GET IMAGE to texture an object. It's not commented, I'm afraid.



I love Star Trek.
Especially the Episodes with Starships in.
CD On CD
22
Years of Service
User Offline
Joined: 23rd Sep 2002
Location: United States
Posted: 7th Oct 2002 07:09
david89:
perhaps you could start a decent manual (PDF) with examples???

your way of explaining is EASY & GREAT!

United We (Still) Stand
TGWDNGHN
22
Years of Service
User Offline
Joined: 2nd Oct 2002
Location:
Posted: 16th Oct 2002 23:13
A few Qs...

1. When using the sprite command does it make a new sprite?
2. If So does the Get image command ADD image data to the sprite (if you use it mre than once in on the same sprite)?
3. if not then does it just show an instance of the image (i'ld have to make a for-loop to make it animate...)?

Milamber
22
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 19th Oct 2002 16:32
1: No, it just changes the old one to the new settings.
2: n/a
3: Yes. In DBPro, and maybe DB as well (not sure), there are actual commands for animating sprites.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM

Login to post a reply

Server time is: 2024-11-27 11:05:09
Your offset time is: 2024-11-27 11:05:09