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 / Looking for a way to initialize a sprite without putting it on the screen.

Author
Message
gladi8r
18
Years of Service
User Offline
Joined: 29th Jan 2008
Location: In your fridge, eating all your food
Posted: 23rd Aug 2011 16:32
Hello,
I'm looking for a way to assign a sprite to a sprite number without putting it on the screen, or perhaps remove the sprite from the screen quickly. The reason for this is that I am trying to make my program, a Breakout clone, run the same way with any screen resolution, which requires the use of the STRETCH SPRITE command. I don't want all of these sprites interfering with collision detection and slowing the game down even if they're hidden, but I want to be able to stretch the sprites to a suitable length. How might I be able to go about doing this?
Thanks,
gladi8r

Retrotastic!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 23rd Aug 2011 17:37 Edited at: 23rd Aug 2011 17:42
I think that Autocam off allows you to do all that before you start the game. Once you start the game you shouldn't mess with the display anyway. If that doesn't work you could try using a hidden Bitmap, say screen 2, and that doesn't get seen by the user either. And what about sync, do sprites autosync? Because you should be able to do what you like before a sync as well.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 23rd Aug 2011 17:43
As Pincho - Set your sync rate and before any sync commands do any of your initialisations. You can then hide or show them before any other syncs...

Warning! May contain Nuts!
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 23rd Aug 2011 17:52
You can just create the sprite outside the screen:

Or create a temp image/bitmap to write to:
gladi8r
18
Years of Service
User Offline
Joined: 29th Jan 2008
Location: In your fridge, eating all your food
Posted: 23rd Aug 2011 19:18 Edited at: 23rd Aug 2011 19:48
This would all be so much easier if there was just a command to stretch an image. Sprite work seems to me the most annoyingly deficient section of the language (yes, I know it was meant for 3D, but it's still irritating). CLS doesn't get rid of sprites, and when I make a temporary bitmap and initialize the sprites there, when I reference the sprites later in the code, DBPro asserts that they do not exist.
I'll show you what I'm talking about, and cut out some repetitive code for brevity's sake:


I don't know if this is right, but I've followed the instructions as closely as I can, and I don't quite understand why it isn't working. If this doesn't give anyone quite enough context I can upload the file.

Retrotastic!
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 23rd Aug 2011 20:37 Edited at: 23rd Aug 2011 20:38
As fas as I can see there isn't a paste sprite command in your code. So the sprites won't be drawn.
And set sprite is only needed once, just call set sprite 1, 0, 1 at the beginning of your code.
edit
Quote: "This would all be so much easier if there was just a command to stretch an image"
You can use image kit for this
aerostudios
17
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 27th Aug 2011 01:10
Do you want to stretch the sprite(s) or perhaps scale them?

I use images (PNG types) for my sprites.
Load them first, and then create sprites from them.

Then I hide them until needed using HIDE SPRITE (xx)

Russell B. Davis/aerostudios
Quel
17
Years of Service
User Offline
Joined: 13th Mar 2009
Location:
Posted: 27th Aug 2011 01:30
Who uses CLS nowadays...

-In.Dev.X: A unique heavy story based shoot'em ~35%
-CoreFleet: An underground commander unit based RTS ~15%
-TailsVSEggman: An Sonic themed RTS under development for idea presentation to Sega ~15%

Login to post a reply

Server time is: 2026-07-10 10:21:11
Your offset time is: 2026-07-10 10:21:11