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.

2D All the way! / Paste Sprite Command

Author
Message
Torrey
21
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 29th Aug 2004 01:46
Hello all,

I'm new to DarkBasic Professional, but not new to programming in general. This is my first post, and my question is:

Why is the "paste sprite" command only able to paste one copy of the sprite?

For making tile based games it would be much easier to use that command to generate the tiles I need instead of using a for..next loop with "clone sprite."
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 29th Aug 2004 03:43
hi

Erm...It can paste multiple copies to the screen of the same sprite

Try this



pizzaman
Torrey
21
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 29th Aug 2004 05:43 Edited at: 29th Aug 2004 06:14
Your example did work, but in my case I've used a sub routine that sets up the tiles. The very first thing I tried was the paste sprite, but after it exits the sub routine and sync, or even if I sync before the return all the pasted sprites disappear. To fix that problem I cloned some blocks that I needed a bunch of times then placed them in my 2d space with the sprite command and they stayed on screen without disappearing. Almost sounds like a bug to me.

To see how it disappears like it does for me I'll use your example code.


[edit]..I just tested your example in a similar way within my do...loop ran the game and it drew the pasted sprites and then afterwards the pasted sprites disappeared. Those pasted sprites were the last thing drawn to the screen which would make you think they'd stay fine, but they keep disappearing.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Aug 2004 06:52
Yes, there is some sort of sync problem. Try using.....

Sync
Sync


Two syncs.

Torrey
21
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 29th Aug 2004 07:28 Edited at: 29th Aug 2004 07:28
Two syncs doesn't work either. I will put the link to the source and media below for you guys to tweak and play with. This was just started today (Aug. 28th) and there is no intention to make this in to something larger. It's only 2D experimentation. The media included inside the zip file is copyrighted by Nintendo of America.

http://www.blackgate.us/zelda.zip

This code is intended for use with the DarkBASIC Professional compiler
pizzaman
22
Years of Service
User Offline
Joined: 18th Feb 2004
Location: Gateshead, UK
Posted: 29th Aug 2004 08:13 Edited at: 29th Aug 2004 08:15
hi Torrey

The problem is your using the paste image command wrong. When you create a sprite in DBP the 3D backdrop is automatically initialized (because sprites in DBP are just 3D plains locked to the screen), which draws over any 2D onscreen. Therefore to get the paste sprite command to paste the sprite, you have to put the command in the main loop so it gets drawn to the screen everyloop.
The second way to do it is to turn off the backsave feature in the set sprite command, this method allows you to paste sprites outside the main loop and they will be there until they are drawn over; an example for this method is below, also be aware that you are responsible for clearing the screen if you use this method.



pizzaman
Torrey
21
Years of Service
User Offline
Joined: 20th Aug 2004
Location: New Jersey
Posted: 29th Aug 2004 08:57
One gold star for pizzaman! It worked, and now I'll get to experimenting with the tile placements with it. The code should shrink down a bit now, and the computer's RAM spared from the likes of more sprites.

Thanks!
MickBerg
22
Years of Service
User Offline
Joined: 21st Feb 2004
Location:
Posted: 7th Sep 2004 04:50 Edited at: 7th Sep 2004 04:58
I would like to paste a background image onto my screen, but it seems I have to do it within the game loop. This slows the game to a crawl.

Thanks for the suggestion, pizzaman. But my game has sprites whizzing all over the screen, so the background would have to be refreshed every time the game loops, wouldn't it?

Thanks,

Mick.

Login to post a reply

Server time is: 2026-06-11 17:33:41
Your offset time is: 2026-06-11 17:33:41