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 / Clone Sprite problems

Author
Message
mcdaidd
16
Years of Service
User Offline
Joined: 5th Nov 2009
Location:
Posted: 12th Mar 2010 20:29
Hi, I'm really new to DarkBASIC and I've absolutely no idea how to use the clone sprite command.

Even on the most basic level, when I load an image of a small red box and clone it, the cloned sprite always appears as a white dot?

Here's the code I used:



Sorry if it's a really obvious and simple mistake, I'm just not great with the language yet.

Thanks!
Virtual Nomad
Moderator
20
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 12th Mar 2010 20:47 Edited at: 12th Mar 2010 20:58
understand that the sprite command does 2 things at once. it creates and positions the sprite.

in your example:

line 1: you create sprite 1 using image 1 and place it at 100,200

line 2: clones the sprite as sprite 2, as you'd expect, using the same image 1 and places it at the same 100,200 coordinates.

line 3: re-creates sprite 2, places it at 150,250 but uses image 2 (because you told it to) which may or may not exist; that's your white dot and where the mistake lies.

in your example, clone sprite is unneccesary (clone sprite has it's uses but it doesn't appear fitting here). if you want a second sprite, simply create it via the same sprite command while assigning the same image as the first. ie:

sprite 1,100,200,1
sprite 2,150,250,1 (not 2, unless you really want to use image 2)

hope this helps. good luck!

btw, here's a bit of code to show a basic use for clone sprite.


Virtual Nomad @ California, USA
AMD Phenomâ„¢ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
mcdaidd
16
Years of Service
User Offline
Joined: 5th Nov 2009
Location:
Posted: 12th Mar 2010 20:53
Ahh, perfect, thanks a lot for explaining!

Login to post a reply

Server time is: 2026-07-27 07:33:23
Your offset time is: 2026-07-27 07:33:23