creepycrawler?

Wow i thinks i found an actual bug…errr Feature! yea thats it.
OK.
screen.Drawscaledobject( 620, 230, 2, 2, varr.but_off ) 'good

So the scale params are supposed to be floats, natch but the above works.
Until you add the ( i swear i saw it somewhere - recently documented alpha parameter) then it errors with type mismatch
screen.Drawscaledobject( 620, 230, 2, 2, varr.but_off, &hFFFFFF99 ) 'no good

but when you do it correctly:
screen.Drawscaledobject( 620, 230, 2.0,2.0, varr.but_off, &hFFFFFF99) 'good

Now it flys!

Thanks for this tip. But wait… this “alpha parameter” , are you saying I can colorize my bitmaps?

edit: or do you just mean I can adjust the transparency (alpha)?

“Romans_I_XVI” wrote:
Thanks for this tip. But wait… this “alpha parameter” , are you saying I can colorize my bitmaps?

edit: or do you just mean I can adjust the transparency (alpha)?

Both. The whiter your bitmap is the more it will “absorb” the color
So if your bit map is white - screen.drawobject( x, y, bitmap, &hFF00007d) will produce a red bitmap at roughly 50% transparency.
You can thank EnTerr for this tip.

This is awesome! I just wish I could get this into a sprite though! I could still do it in a hackish way I suppose, could have a fully transparent sprite for collision handling and then draw this over it. Would I take a performance hit doing that? Or is there a better way of doing it? (I thought it wasn’t possible before now so still happy)

“squirreltown” wrote:
Wow i thinks i found an actual bug…errr Feature! yea thats it.
OK.
screen.Drawscaledobject( 620, 230, 2, 2, varr.but_off ) 'good

So the scale params are supposed to be floats, natch but the above works.
Until you add the ( i swear i saw it somewhere - recently documented alpha parameter) then it errors with type mismatch
screen.Drawscaledobject( 620, 230, 2, 2, varr.but_off, &hFFFFFF99 ) 'no good

but when you do it correctly:
screen.Drawscaledobject( 620, 230, 2.0,2.0, varr.but_off, &hFFFFFF99) 'good

Now it flys!

Thanks for the bug report. I confirmed the issue.

Ok so I am using this to give the appearance of an object fading out in opacity. I thought that the hex constant &h was just a representative of a decimal intiger, as in &hFFFFFFFF = 4294967295 (http://sdkdocs.roku.com/display/sdkdoc/ … +Reference Section 3.3). Maybe I was completely wrong. Either way 4294967295 gives me a tinted red bitmap where &hFFFFFFFF gives me what I expected.

I might just not be understanding how hex is being used here, but instead I implimented this function for the time being which is working great, it just seems a bit excessive, figured there might be a more efficient way if anyone here is more knowledgable. Thanks.


Function reduce_transparency_hex(hex)
    if hex = &hFFFFFFFF
        hex = &hFFFFFFEF
        return hex
    else if hex = &hFFFFFFEF
        hex = &hFFFFFFDF
        return hex
    else if hex = &hFFFFFFDF
        hex = &hFFFFFFCF
        return hex
    else if hex = &hFFFFFFCF
        hex = &hFFFFFFBF
        return hex
    else if hex = &hFFFFFFBF
        hex = &hFFFFFFAF
        return hex
    else if hex = &hFFFFFFAF
        hex = &hFFFFFF9F
        return hex
    else if hex = &hFFFFFF9F
        hex = &hFFFFFF8F
        return hex
    else if hex = &hFFFFFF8F
        hex = &hFFFFFF7F
        return hex
    else if hex = &hFFFFFF7F
        hex = &hFFFFFF6F
        return hex
    else if hex = &hFFFFFF6F
        hex = &hFFFFFF5F
        return hex
    else if hex = &hFFFFFF5F
        hex = &hFFFFFF4F
        return hex
    else if hex = &hFFFFFF4F
        hex = &hFFFFFF3F
        return hex
    else if hex = &hFFFFFF3F
        hex = &hFFFFFF2F
        return hex
    else if hex = &hFFFFFF2F
        hex = &hFFFFFF1F
        return hex
    else if hex = &hFFFFFF1F
        hex = &hFFFFFF0F
        return hex
    else
        hex = &hFFFFFF00
        return hex
    end if
End Function

Here are two bitmaps cross fading.
I know you are using the compositor so you might need some adapting.

for i = 0 to  255
	hexcolor = &hFFFFFF00+i
	hexcolor2 = &hFFFFFFFF-i
   screen.clear(whatev)
	screen.drawobject( 0,0, bitmap, hexcolor) 'fading in 
	screen.drawobject( 0,0, bitmap2, hexcolor2) ' fading out
	screen.swapbuffers()
end for

Lol, so easy… Thanks! Didn’t think it would be as simple as subtracting decimal from the hex :grinning_face_with_smiling_eyes:

Worked perfect! Still loling over this. Replaced a call to a 50 line function to …

color = color - 16

:face_with_tongue:

I always love when big messy code gets replaced by something elegant and simple :slightly_smiling_face:

“Romans_I_XVI” wrote:

I thought that the hex constant &h was just a representative of a decimal intiger, as in &hFFFFFFFF = 4294967295 (http://sdkdocs.roku.com/display/sdkdoc/ … +Reference Section 3.3). Maybe I was completely wrong. Either way 4294967295 gives me a tinted red bitmap where &hFFFFFFFF gives me what I expected.

There are some somewhat subtle issues with respect to specifying integer constants and how type conversions and limit checks are performed.

Hex constants can represent a full 32-bit unsigned range of integers (0 .. &hFFFFFFFF - 4,294,967,295), as overlaid on a 32-bit signed integer variable. Values outside that range get clipped to 32-bits.

Integer constants should represent a full 32-bit signed range, but the current behavior is to only represent integer -999,999,999 .. 999,999,999. Values outside that range get implicitly promoted to type Double.

However, if you pass that Double value to an integer-typed parameter, or assign it to an integer-typed variable, it goes through a narrowing conversion back to signed integer. The value is out of range and in this case happens to be converted to an out of range value &h80000000, which happens to look like a reddish color value.

Oh, thanks for the in depth explanation RokuKC.