Transparent part of sprite causing collision on WebOS 1.4.5

Previous topic - Next topic

MrTAToad


spacefractal

I have to ask:

1. Does this also happens with none transparency png, using pink (etc 8bit png instead of 24bit)?
2. How about using a real alpha png, rather than a transparency color?

Those could been used for col checks only.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Millerszone

Quote from: spacefractal on 2011-Apr-21
I have to ask:

1. Does this also happens with none transparency png, using pink (etc 8bit png instead of 24bit)?
2. How about using a real alpha png, rather than a transparency color?

Those could been used for col checks only.

I am using a real alpha transparency png and I also tried the pink transparency color.

If anyone wants to send me some code to test, I'll be glad to test it.
Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

Slydog

Are you trying to detect if the player presses inside the 'pitch' and 'swing' button areas?
They are both triangular, so do you have rectangular pngs for both, but only want to detect the non-transparent portion?

You could try detecting the touch by checking if the touch point is inside the triangular button by using the following function:
(from a Visual Basic 6 project of mine, so it will need to be converted to GLBasic, but simple (excuse my old naming convention!))

Code (glbasic) Select
Public Function gxTriangle_IsPointInside(uXY As udtPoint, uT1 As udtPoint, uT2 As udtPoint, uT3 As udtPoint) As Boolean
    Dim fAB As Double
    Dim fBC As Double
    Dim fCA As Double

    fAB = CDbl((uXY.y - uT1.y) * (uT2.x - uT1.x)) - CDbl((uXY.x - uT1.x) * (uT2.y - uT1.y))
    fBC = CDbl((uXY.y - uT2.y) * (uT3.x - uT2.x)) - CDbl((uXY.x - uT2.x) * (uT3.y - uT2.y))
    fCA = CDbl((uXY.y - uT3.y) * (uT1.x - uT3.x)) - CDbl((uXY.x - uT3.x) * (uT1.y - uT3.y))

    If (fAB * fBC > 0) And (fBC * fCA > 0) Then
       gxTriangle_IsPointInside = True
    Else
       gxTriangle_IsPointInside = False
    End If
End Function


udtPoint is a TYPE with only (x, y) properties.
uXY is the Touch point.
uT1,uT2,uT3 are the Triangle 3 points.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Millerszone

Slydog I fixed all of the buttons. The problem is, the transparency part of the sprite(bat) is triggering collisions with WebOS 1.4.5

Thanks anyway.






Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

Millerszone

I made a small program with just the original baseball background, bat and ball, with bat and ball collision an of course it didn't work the first time, but after a few changes I got the ball to go through the bat's transparency without collision. Here is what I did.

First, for the bat I changed the mode to indexed color, then back to RGB Color in photoshop, so now the bat is pure black with a transparency background, then I filled the background with RGB(255,0,128).
Now for the ball, just like the bat, I changed the mode to indexed color, then back to RGB Color in photoshop, so now the ball is pure black with a transparency background, but I didn't change the background to RGB(255,0,128), or else the ball would collide with the bat's transparency.

So, I thought I found a temporary fix, nope. Just by adding another sprite to the code and ball would collide with the bat's transparency. So very inconsistent.

It seems like the problem is coming from LOADSPRITE, because SPRCOLL doesn't work when using LOADSPRITE, but Gernot test program above worked with SPRCOLL, but he didn't use LOADSPRITE.
Also BOXCOLL works perfect.

Just a guess. :S
Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

Slydog

Could you load them in using LOADSPRITE then draw them to the screen and copy them into a new sprite?  Or would that loose the transparency? 

And, this is for the actual bat and ball in the game area?  I had assumed this game was in 3D mode but maybe used 2d physics.  If this is purely 2D then bravo, very well simulated!  :nw:

[Edit] Not to imply that if it's in 3D that it isn't as impressive! ha
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

Millerszone

Yes, I tried grabsprite, lost the transparency.

HTD Baseball is all 2D, this is only my second game, so 3D was out of the question. If I was going do something like this again
I would use 3D. I'm probably going to add Box2D to improve the bat and ball physics.


Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

Millerszone

Gernot I finally got passed the "Permission denied". here is the log:
Code (glbasic) Select
root@palm-webos-device:/media/cryptofs/apps/usr/palm/applications/com.glbasic.support# ./glbasic-webos-exe
SDL_init video
SDL_GetVideoInfo = 320x480 @ 32 bpp
Setting video mode: 0x0x0 fl=2
SDL_SetVideoMode seems to be 1
BGRA ext supported
exepath: /media/cryptofs/apps/usr/palm/applications/com.glbasic.support/glbasic-webos-exe
Init Finalized
Shut down GLB
glb is shut down
PDL_Quit
</PDL_Quit>
exit

Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

Kitty Hello

I get no error. There's a bug in glReadPixels from a framebuffer object then. Oh my.
I'll contact Palm.

ampos

Quote from: Kitty Hello on 2011-Apr-22
I get no error. There's a bug in glReadPixels from a framebuffer object then. Oh my.
I'll contact Palm.

Perhaps related with the mem2sprite bug?
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Kitty Hello


ampos

Quote from: Kitty Hello on 2011-Apr-22
sprite2mem will not work, I think.

No, ir didnt work. In fact, it crashes the apps.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Kitty Hello

caan you paste the crashlog? (DeviceShell output)

ampos

check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE