| View previous topic :: View next topic |
| Author |
Message |
Marman57
Joined: 17 May 2006 Posts: 2
|
Posted: Wed May 17, 2006 3:23 am Post subject: help w/ Image transparency & object Collision |
|
|
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. |
|
| Back to top |
|
 |
JorDy
Joined: 11 Dec 2005 Posts: 121
|
Posted: Wed May 17, 2006 4:13 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Marman57
Joined: 17 May 2006 Posts: 2
|
Posted: Wed May 17, 2006 8:13 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
shifty_bill
Joined: 07 Jan 2006 Posts: 8
|
Posted: Wed May 17, 2006 10:42 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|