explode .png in a simple way
in
Programming Questions
•
1 year ago
I want my "comet5.png" to explode on inpact with earth.png
I have tried the "explode" tutorial, but it seems I cant solve it...
The image doesnt need to explode , i figure, i can spawn 4 pieces of the picture
on the same location as the impact and throw the pieces in different directions... but it's probably easier to learn how to explode thinks from the start.
somebody who wants to save my night?
- PImage kometen;
- class komet{
- int a = 15;
- int b = 15;
- float x = 0;
- float y = 0;
- float komet1,komet2;
- komet(float _x, float _y){
- x = _x;
- y = _y;
- float speed = 1;
- float ang = atan2(height/2-y, width/2-x);
- komet1 = cos(ang)*speed;
- komet2 = sin(ang)*speed;
- }
- void movement(){
- x +=komet1;
- y +=komet2;
- }
- void kometer(){
- kometen = loadImage("komet5.png");
- imageMode(CENTER);
- image(kometen, x, y);
- noStroke();
- }
- void collision(){
- if ( dist(x, y, i1, i2) < i3) {
- println("traff");
- x = 1000000;
- y = 1000000;
- i++;
- }
- }
- void smart(){
- movement();
- kometer();
- collision();
- }
- }
1