File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ public class code_swarm extends PApplet {
63
63
int FRAME_RATE = 24 ;
64
64
long UPDATE_DELTA = -1 ;
65
65
String SPRITE_FILE = "particle.png" ;
66
+ String MASK_FILE = "src/mask.png" ;
66
67
String SCREENSHOT_FILE ;
67
68
int background ;
68
69
@@ -93,6 +94,7 @@ public class code_swarm extends PApplet {
93
94
PFont font ;
94
95
PFont boldFont ;
95
96
PImage sprite ;
97
+ PImage avatarMask ;
96
98
97
99
boolean paused = false ;
98
100
@@ -332,6 +334,8 @@ public void setup() {
332
334
String SPRITE_FILE = cfg .getStringProperty (CodeSwarmConfig .SPRITE_FILE_KEY );
333
335
// Create the file particle image
334
336
sprite = loadImage (SPRITE_FILE );
337
+ avatarMask = loadImage (MASK_FILE );
338
+ avatarMask .resize (cfg .getPositiveIntProperty ("AvatarSize" ), cfg .getPositiveIntProperty ("AvatarSize" ));
335
339
// Add translucency (using itself in this case)
336
340
sprite .mask (sprite );
337
341
}
@@ -1476,7 +1480,10 @@ class PersonNode extends Node {
1476
1480
mLastPosition .add (mPhysicsEngine .startVelocity (this ));
1477
1481
mFriction = 0.99f ;
1478
1482
String iconFile = avatarFetcher .fetchUserImage (name );
1479
- if (iconFile != null ) icon = loadImage (iconFile , "unknown" );
1483
+ if (iconFile != null ) {
1484
+ icon = loadImage (iconFile , "unknown" );
1485
+ icon .mask (avatarMask );
1486
+ }
1480
1487
}
1481
1488
1482
1489
/**
You can’t perform that action at this time.
0 commit comments