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.

DarkBASIC Professional Discussion / Sprite vs Paste Image

Author
Message
Shadow
23
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 22nd Apr 2003 13:50
When you want to make a 2d game, you are supposed to use sprites, but I have found 'paste image' to have the following advantage:

If you want something to go away, you don't need to 'DELETE SPRITE', you just don't draw the thing!

Also, I don't like the way the SPRITE command controls both sprite creation and positioning (but maybe that's just me).

OK, so sprites have commands that you can't do with pasting image, like MIRROR and ROTATE, but those commands are only useful in limited situations anyway.

Post your views.
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 23rd Apr 2003 01:08
You would have to write your own collision routines.
HZence
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 23rd Apr 2003 02:07
Guess what?!?!? I have to do my own collision routines anyway because the stupid SPRITE COLLISION commands don't work!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Shadow
23
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 23rd Apr 2003 15:05
That's true about collision, but I think I could do it. In one of my many never-completed (i.e. about 5% done) games, I did sliding collision for sloped lines. Trouble is, one you reached the end of each segment of the wall, instead of sliding onto the next, you slid right through the wall. Oops.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Apr 2003 16:19
Of course, with an image you always have to draw it. With a sprite, it draws itself.

This also means also that you only have to put code in for when something changes (eg when you move it move it), rather than dealing with it every loop.

However, I agree that it's a pain to move a sprite - we do need a POSITION SPRITE command.
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 24th Apr 2003 02:50
As dbpro does not have pixel perfect collision you will need to do some collisions yourself anyway. I use a mix of built in sprite collision and maths.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Apr 2003 10:26
True, but if you haven't moved a sprite, and it wasn't colliding with anything the last time it moved, then it won't be colliding with anything now, unless another sprite has moved over it... So again, you only have to put code in for when something changes.

Besides, I use my own pixel-perfect collision routine anyway (look under code snippits).
Freddix
AGK Developer
23
Years of Service
User Offline
Joined: 19th Sep 2002
Location: France
Posted: 24th Apr 2003 12:26
shadow , I agreeing with you for sprite positionning . . .

I asked in DBDN about a "Position Sprite SPRITE,XPOS,YPOS" command.
I don't know if it will be added but I hope.

I'm happy to see I'm not alone to dislike to be obliged to use the same command to create / move sprites.

Shadow
23
Years of Service
User Offline
Joined: 17th Oct 2002
Location: In the shadows
Posted: 24th Apr 2003 14:20
Quote: "Of course, with an image you always have to draw it. With a sprite, it draws itself."


This is exactly what I don't want. I don't want my program to do things I haven't asked it to.

I suppose I effectively use similar techniques to the sprite commands, but a major difference is, if you go to a different part of a program using 'paste image' all your previous images will disappear as they should, but with sprites you have to delete or hide each and every one of them.
Richard Davey
Retired Moderator
24
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 24th Apr 2003 15:07
"This is exactly what I don't want. I don't want my program to do things I haven't asked it to."

That's like putting a 3D cube on the screen and saying "why is it stil there? I don't want DB to keep it there if I haven't asked it to"! Sprites are entities, if you create them, you look after them. You move them, hide them, rotate them etc. If you bought them into the world, you take them out again. The fact they remain on-screen unaided is, quite frankly, their entire reason for existing!

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
TheCyborg
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 24th Apr 2003 15:22
Well the position sprite command is actually the SPRITE command, you just have to put the image number in the end. I always use this for positioning them.
SPRITE spritenumber, xpos, ypos, imagenumber

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th Apr 2003 15:40
Yes, we know that. It's just a pain to keep having to respecify the image each time we move the sprite.

If you are using animated sprites, then this becomes even more of a pain.

Login to post a reply

Server time is: 2026-07-11 06:06:51
Your offset time is: 2026-07-11 06:06:51