Hoshasei
YaBB Newbies
Offline
Posts: 11
Image transparancy complication
Sep 14th , 2009, 3:35pm
Ok so here is the problem, I've got the cat to appear transparent but for some reason the back ground wont go over it so the instances of the cat stack on top of each other and block out the background. I think processing needs some work, but im sure there is a way around this. The other part that bugs me is that it doesn't even do it incorrectly consistently; some times a gray box, white, or even on occasion you can see the desktop or other windows. everything you need to run the program is here, you may need to look to see what im talking about. <code> animal meow; PImage outside, house, back, cat; void setup() { size(200, 150); outside = loadImage( "outside.png" ); house = loadImage( "house.png" ); cat = loadImage( "kitty.png" ); back = outside; meow = new animal(cat, 0); frameRate(50); } void draw() { background(0); meow.update(); meow.draw(); } class animal { PImage img; int imgCol, imgRow, //animation, direction currentX, targetX, patience; animal (PImage img, int x) { this.img = img; currentX = x; patience = 1; } void update() { patience--; if ( patience == 0) { patience = int ( random(80, 110)); targetX = int ( random(-65, 305)); imgCol=30; } walk(); } void draw() { image (back, -currentX, 10); copy (cat, imgCol, imgRow, 30, 30, 65, 95, 30, 30); } void walk() { imgCol = -imgCol + 30; if ( targetX < currentX ) { currentX--; imgRow = 30; } else if ( targetX > currentX ) { currentX++; imgRow = 0; } else imgCol = 60; println(imgCol); } } </code> http://picasaweb.google.com/lh/photo/0CEWGEDn3q21F8XMIuUUXg?feat=directlink http://picasaweb.google.com/lh/photo/9BZNYLFYe4Z-kKXHHG1rtA?feat=directlink http://picasaweb.google.com/lh/photo/tEcHR62zGhW0prc82LcEJA?feat=directlink I'd much appreciate your help as i will need this knowledge for many projects i plan on doing and am in progress of making