PLAYMUSIC WITH LAG and IMAGE BORDERS

Previous topic - Next topic

galiksoft

Hi people.

I'm developping a bombs game but I found 2 problems.

I use a background music (mp3), a clock tik-tok when the bomb's time remaing counter is above 2 seconds, but when it reaches 2 seconds, the music must change to a fast alarm, i.e, another mp3 file. The sounds changes well, but at the change's moment, the mouse pointer disappear for a while and after that, it appear in another screen position. It seems like a lag caused by the music change.
I used STOPMUSIC before PLAYMUSIC "second_file.mp3" and I thought the problem was it; after I removed STOPMUSIC command, and the problem wasn't solved.
To make sure, the problem is not caused by my game code, I has a version with no sounds, so no calls to playmusic...and there are no problems!
How can I solve this problem?


Second Problem:
I use polyvector commands to draw the sprites. My sprites are pngs with transparency. I use this function:

Code (glbasic) Select

FUNCTION draw: polis%, xxx%, yyy%, mode, dimx%=0, dimy%=0
LOCAL originx%, originy%

GETSPRITESIZE polis, originx, originy

IF mode>0
dimx=mode*originx/100
dimy=mode*originy/100
ENDIF

STARTPOLY polis
POLYVECTOR xxx, yyy, 0, 0, RGB(255, 255, 255)
POLYVECTOR xxx, yyy + dimy, 0, originy, RGB (255, 255, 255)
POLYVECTOR xxx + dimx, yyy + dimy, originx, originy, RGB(255, 255, 255)
POLYVECTOR xxx + dimx, yyy,  originx,  0, RGB(255, 255, 255)
ENDPOLY
ENDFUNCTION


The images are drawn at right positions with right zoom, but they appear with a white border. I removed the ", RGB(255, 255, 255)" part, but the borders are still there... I don't want any border. I just want the visible part of the png, with no borders!
Help me please

Ian Price

Don't know about the .MP3 problem, but .MP3 files take a short time to seek as they are not loaded like .WAV files. Can you not make the last two seconds of music a .WAV file and play that as required? It gets around the issue.

Use SMOOTHSHADING FALSE before using the polyvector commands to eradicate the border.
I came. I saw. I played.

galiksoft

Thanks.

I'm going to convert to wav format, and use that command.

Hemlos

Did smoothshading work?
Make sure the image dimensions are powers of 2(32,64,128,etc)
Opengl is picky, in both 2d and 3d.
Bing ChatGpt is pretty smart :O

Wampus

If the source image for the Polyvectors is already a power of 2, is the white border problem the same as this one? http://answers.unity3d.com/questions/10302/messy-alpha-problem-white-around-edges.html

I suspect it is, from your description. The above discussion might be helpful. If you use Photoshop then the discussion also mentions a filter you can install to help with the white borders problem.