Permalink
Browse files

Avatar mask.

  • Loading branch information...
1 parent 2a71a89 commit 4b6c0e90ff1e7aff46b8ae0c5c0086348c94f20e @sandofsky sandofsky committed Feb 3, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/code_swarm.java
  2. BIN src/mask.png
View
9 src/code_swarm.java
@@ -63,6 +63,7 @@
int FRAME_RATE = 24;
long UPDATE_DELTA = -1;
String SPRITE_FILE = "particle.png";
+ String MASK_FILE = "src/mask.png";
String SCREENSHOT_FILE;
int background;
@@ -93,6 +94,7 @@
PFont font;
PFont boldFont;
PImage sprite;
+ PImage avatarMask;
boolean paused = false;
@@ -332,6 +334,8 @@ public void setup() {
String SPRITE_FILE = cfg.getStringProperty(CodeSwarmConfig.SPRITE_FILE_KEY);
// Create the file particle image
sprite = loadImage(SPRITE_FILE);
+ avatarMask = loadImage(MASK_FILE);
+ avatarMask.resize(cfg.getPositiveIntProperty("AvatarSize"), cfg.getPositiveIntProperty("AvatarSize"));
// Add translucency (using itself in this case)
sprite.mask(sprite);
}
@@ -1476,7 +1480,10 @@ public void drawJelly() {
mLastPosition.add(mPhysicsEngine.startVelocity(this));
mFriction = 0.99f;
String iconFile = avatarFetcher.fetchUserImage(name);
- if (iconFile != null) icon = loadImage(iconFile, "unknown");
+ if (iconFile != null) {
+ icon = loadImage(iconFile, "unknown");
+ icon.mask(avatarMask);
+ }
}
/**
View
BIN src/mask.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4b6c0e9

Please sign in to comment.