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 / Sound and sprites

Author
Message
Torq
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location:
Posted: 7th Oct 2004 10:05 Edited at: 7th Oct 2004 10:28
A few quick questions.


I am working on a program that allows me to move a sprite around the screen then play a sound on mouse click.

I loaded the sprite example and replaced the background and sprite with my own pics. All is fine.

Then I added a line of code like this.

load sound "c:\sound\mysound.wav",1

if mouseclick()=2
play sound 1
endif

This worked a few times then it crashed my computer now it crashes everytime I run it. Im using DBC. Any explanations or solutions ? Sound file is fine, location is right etc... It just stoped running correctly. Im on xp and have the patches. It even started running minimised and I had to adjust my vid card settings to get it to come back open. I put the settings to the orginal state and dbruns fine now but wont run this program right with the sound code in it now. This sound code works in the sound example code which is basicly the same.

quesiton 2: Ive made another sprite but I can only get one or the other other too diplay not both.

I use load bitmap
then get image
then sprite #,x,x,#

Ive tried to use a different number for the image and get command again its just one or the other. Could someone please pose some code that would load 2 or 3 different sprites (not background). Sorry I didnt post code Im dont have db on this comp and Im new so(I dont have it all right in my head yet)

Thanks in advance

http://rageoebel.freehomepage.com/images/eye2.jpg
Lost in Thought
20
Years of Service
User Offline
Joined: 4th Feb 2004
Location: U.S.A. : Douglas, Georgia
Posted: 7th Oct 2004 14:11
May want to try something like this. To keep the sound from trying to replay everytime the program loops while the mouse button is held. And only play once per press.


As far as the sprites a little more information is needed ... the size of the sprites, screen size, and possibly other things. A sprite can over write another you can adjust the order in which they draw using set sprite priority.

[OOPS] Just noticed you said DBC this stuff may or may not apply as I only have DBP. Hope this helps if not someone else will be along hopefully.

Torq
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location:
Posted: 7th Oct 2004 14:45
Thanks for the sound tips I think thats what happening.

As far as the sprites. I am just trying to make 2 sprites show on the screen one is moveable by the mouse the other I place at the corner of the screen but it still shows the same sprite. Ill post some code later.

I have 2 sprites on the screen in different positions. One can move with the mouse the other is static. Problem is that they both show the same sprite no matter what I try. I have 2 different sprites but I can only have 2 of the same on the screen I cant get it to show each different kind.

EX
X is sprite 1
y is sprite 2
These represent sprites not variables.

Screen looks like this
-----------------------
x
x
----------------------
or
----------------------
y
y
---------------------

I want

---------------------
x
y
--------------------

But I cant get the code right. Im grabbing them properly but I just cant make 2 different sprites on the screen at the same time. Thats the code help I meant.
Thanks for the reply!!!!

http://rageoebel.tripod.com
PoHa!84
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 7th Oct 2004 14:49 Edited at: 7th Oct 2004 14:50
yep, that should work with DBC too, LIT

as far as your sprite problem, (not having any source code to go off of) I suggest you check to make sure that you're not putting two different images on the same sprite, (surely that's not it...) or making sure that each are in different positions...

other than that, i don't know

/edit same time post...

something
PoHa!84
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 7th Oct 2004 14:54
hmm... my only guess is that somewhere in your code there's a loop that's placing the images different from what you want...

heehee... its really hard to help someone who doesn't post a code snippet...but its a nice challenge, all the same

something
Torq
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location:
Posted: 7th Oct 2004 14:58
Sorry about the code.
Ill post some in a bit. Im a way from my comp that has DB on it.

Thanks for the help though.
I just wanted an example of code that would put 2 different sprites on the screen in different places so I could see it.

http://rageoebel.tripod.com
PoHa!84
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 7th Oct 2004 15:18
Oh, well how's this then?



something
Torq
20
Years of Service
User Offline
Joined: 18th Jan 2004
Location:
Posted: 7th Oct 2004 15:25
Great Thanks
I was using load bitmap
But this gives me something to go off of.


http://rageoebel.tripod.com
PoHa!84
20
Years of Service
User Offline
Joined: 2nd Oct 2003
Location: To your left.
Posted: 7th Oct 2004 15:34
Not sure on this, but load bitmap+get image should do pretty much the same thing, but loading a bitmap is usually for when you want to edit the bitmap from within your program, and load image is for when doesn't need changing.

Anyways, hope that little code helped; that is, when you get back to your other CPU

something

Login to post a reply

Server time is: 2024-09-23 02:37:51
Your offset time is: 2024-09-23 02:37:51