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 / Commands don't seem to work

Author
Message
SonicX
21
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 18th Oct 2003 16:44

I've got a command

S=SPRITE ALPHA(1)

It doesn't matter what value I put as "S", the SPRITE ALPHA(1) is still at 255

Also a similar problem,

SYNC RATE V

No matter what value V is my program doesn't run any faster

Please Help
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 18th Oct 2003 19:44
S=SPRITE ALPHA(1) will return the current alpha value.
To change the value use
SET SPRITE ALPHA SpriteNumber, Alpha

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 18th Oct 2003 19:51 Edited at: 18th Oct 2003 19:53
Ok, you have a lot to learn, but asking questions is the first step.

First off, SYNC RATE only sets the maximum allowed frame rate. It limits your rendering speed. If you want the fastest rate possible, use SYNC RATE 0 which means set no limits.

S=SPRITE ALPHA(1)

This is a much bigger problem because you have misunderstand a VERY fundamental part of computer programming.

In nearly all computer languages, the equals sign has a context sensitive nature. it can be used to TEST for equality.

if bubba = jim_bob then kill_varmit()

It can also be used to assign a value.

S=SPRITE ALPHA(1)

In all cases of assignment the value on the left is set by the value on the right. So, the function call SPRITE ALPHA(1) will always change S to match the return value of the function. If S was previously set to 128 (as an example), its value would be completely overwritten by the return value of SPRITE ALPHA(1).

Let's look at the help file...

SPRITE ALPHA
This command will return the Alpha value of the specified sprite. The alpha value determines how much translucency the sprite has, 255 being completely solid. You should specify the Sprite Number as an integer value.

The key word here is return. This function never sets the alpha value, it only returns the current alpha value of sprite one in this case. As long as sprite one never changes, the value of S never changes.

This brings us to the command that you really wanted...

SET SPRITE ALPHA
This command will set the alpha value of the specified sprite. The alpha controls how much of the sprite is present on screen and is used to create a translucent sprite. The Alpha value range is 0 to 255, with 255 being completely solid and 0 being invisible. The parameters should be specified using integer values.

Finally, the code should read...

SET SPRITE ALPHA 1, S

This will set sprite one to a alpha value equal to S which should be an integer value from 0 to 255. If you forget to set S before calling this function, it will most likely default to zero and your sprite will not appear at all since zero is invisible.

I hope this has been educational.
--
TAZ

Login to post a reply

Server time is: 2024-11-25 12:15:06
Your offset time is: 2024-11-25 12:15:06