help w/ Image transparency & object Collision

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Marman57
Posts: 2
Joined: Wed May 17, 2006 2:41 am

help w/ Image transparency & object Collision

Post by Marman57 »

I am new to programming and my first game I am working on is a side scrolling game and I am trying to remove the white box that forms around the images that I blit into my game. What do i need to do to make the white box transparent.

Also I am having a hard time making collisions with objects. I can get my player to jump and he will land on the object but when he walks off the object the player.gravity is a adjusted to the object.y and he doesn't return to the ground. All the expressions I have tried either stops the player from jumping or just doesn't return him to ground level once on the object. Any help will be greatly appreciated.
JorDy
Posts: 121
Joined: Sun Dec 11, 2005 8:45 am

Post by JorDy »

well for transparency use the Alpha channels (R-G-B-Alpha) so when blitting an image it should be:
image:blit(x, y, Image source, [sourcex, sourcey, width, height], true)
the true at the end is enabling the alpha channel
for transparent colours use Color.new(r, g, b, a) the max is 255 for all R-G-B-A
as for gravity im not sure, best way for collision is to use a collision map check PSPGolf for that
Marman57
Posts: 2
Joined: Wed May 17, 2006 2:41 am

Post by Marman57 »

I am not exactly sure on how to set this up. Can you please elaborate on what you mean by

"for transparent colours use Color.new(r, g, b, a)"

I did set the alpha channel to true in my image:blit(....) but nothing changed. Do i need to do anything to the actual image in Windows paint or other image editing program. Thank you.
shifty_bill
Posts: 8
Joined: Sat Jan 07, 2006 12:49 pm

Post by shifty_bill »

i use photoshop CS2 to make my images transparent

start with the magic wand selector, select the background,
ctrl + shift + i = invert selection
then
ctrl + x (cut)
ctrl + v (paste)
then delete the background layer

and there we go a transparent image
Post Reply