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 / I want to make a 2d game, but I don't fully understand sprites and bitmaps...

Author
Message
Ramses
20
Years of Service
User Offline
Joined: 20th Apr 2004
Location: In ur kitchen, eatin ur foodz
Posted: 21st Apr 2004 23:52
I'm using DarkBASIC w/ DarkMATTER inhancement. (Ver 1.12)

I was wondering if someone could help me. I want to make a 2d game, (something simple, like pong) but as of yet, I can't fully comprehend how to use sprites and bitmaps.
guru of boredom
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: middle of no where
Posted: 22nd Apr 2004 03:11
u rarely use bitmaps (as in LOAD BITMAP) as those are mostly just for storing stuff in. If you wanted to have a sprite as the main character u would:

then you would just change the x and y positions and the sprite will show up right there! the collisions are pretty well explained and so is most of the rest. just look in the help files and the example programs.

email me for more if u still dont get it

we are not outnumbered! we are just in a target rich enviroment!
P4 2.4 ghz 120 GB 256 mb GeForce4
Scouseknight
20
Years of Service
User Offline
Joined: 15th Mar 2004
Location: Bootle, Merseyside, UK
Posted: 22nd Apr 2004 18:53 Edited at: 22nd Apr 2004 18:55
If you want an example of a "game loop" take a look at the 3D Pac Man tutorial - http://www.skgpl.co.uk/projects/pacmantut/index.html - it doesn't use sprites but it has a flowchart and a very basic no frills game loop - that in conjunction with guru's advice will get you going.

If you want to see sprites in action, I recommend another tutorial that I put together (sorry for the plugging here by the way!) at http://www.skgpl.co.uk/projects/platformcollision/index.html it has basic sprite movement and collision detection (although not the collision detection that comes with DarkBasic).

Apologies for the plugging but to be honest they are such basic examples even I could follow them

Edit : Sorry I just realised you have Dark Basic and not Dark Basic Professional - as far as I am aware I haven't used anything in those guides that are specific to Dark Basic Professional - but I am not 100% sure.

soapyfish
21
Years of Service
User Offline
Joined: 24th Oct 2003
Location: Yorkshire, England
Posted: 23rd Apr 2004 02:40
Its pretty simple really,
when your drawing your sprites using MS Paint or whatevr you would need to use the get imgae command. This takes the left,bottom,right and top co-ordinates of the sprite in that order. So something like.


You would then put something like.......


Which would add 5 to the variable plx, wich you "stuck" to your sprite in the first block of code, so if you want, as plx moves your sprite is "stuck" to it and moves aswell.

You'e probaby had a look at scouseknight's tutorial which can beat an explanaton like this 10 fold but if you do want any help just shout.

HEY, YOU THERE, THE ONE READING THIS, WHY NOT VISIT OUR TEAM SITE.
Lord Helmet
21
Years of Service
User Offline
Joined: 30th May 2003
Location:
Posted: 24th Apr 2004 22:21
this hopefully gives you an idea of how it works.
load image gets the .bmp and gives it a number for spriting
the sprite has a number of it's own for keeping track of which object it is, however it displays whichever image you specify based on the number you specified when you did 'load image'

Sprite (sprite number),(Xcoord on the screen),(Zcoord),(Image, by number)

If you set the same sprite to a different location or image, then it recreates the sprite with the new parameters and the old sprite disapears leaving whatever was in it's place before.
Ramses
20
Years of Service
User Offline
Joined: 20th Apr 2004
Location: In ur kitchen, eatin ur foodz
Posted: 24th Apr 2004 23:23
Thanks!

Login to post a reply

Server time is: 2024-11-26 14:32:32
Your offset time is: 2024-11-26 14:32:32