Reference
- Body Classes
-
Body Functions
- (PPBox)getHeight()
- (PPBox)getWidth()
- (PPBox)setSize()
- (PPCircle)getSize()
- (PPCircle)setSize()
- addExcludedBody()
- addForce()
- adjustAngularVelocity()
- adjustVelocity()
- applyMatrix()
- attachImage()
- dettachImage()
- getAngularVelocity()
- getImageAlpha()
- getRotation()
- getVelocityX()
- getVelocityY()
- getX()
- getY()
- isResting()
- isStatic()
- isTouchingBody()
- resetForces()
- setAngularVelocity()
- setDamping()
- setDrawable()
- setFillColor()
- setFriction()
- setGravityEffected()
- setImageAlpha()
- setMass()
- setPosition()
- setRestitution()
- setRotatable()
- setRotation()
- setRotDamping()
- setStaticBody()
- setStrokeColor()
- setStrokeWidth()
- setVelocity()
- World Classes
- World Fucntions
attachImage()
Description
Attach an image to the body. Instead of using fillColor and strokeColor to draw a shape, the body will be shown as an image. The attached image must be the same size of the body in order to appear correctly.
Exemples
PImage myImage = loadImage("image1.jpg");
PPBox myBox = new PPBox(100, 50);
myBox.attachImage(myImage);
world.add(myBox);
Syntax
myBody.attachImage(image);
Parameters
image ->
PImage : the image object to be draw in order to represent this body.