d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Processing Js Question > Trying To Animate This Guy
Add Reply New Topic New Poll
Member
Posts: 16,404
Joined: Mar 28 2009
Gold: 7.69
Sep 12 2016 09:19pm
Code
var x = 250;
var y = 300;

draw = function() {
background(113, 230, 230);

//grass
noStroke();
fill(25, 204, 61);
rect(0, 300, 410, 300);

//cape
fill(255, 0, 0);
triangle(240, 210, 270, 210, 290, 240);

//person
fill(20, 18, 18);
ellipse(250, 200, 30, 30);
stroke(0, 0, 0);
strokeWeight(3);
line(250, 260, 250, 210);
line(250, 240, 220, 200);
line(220, 220, 250, 240);
line(251, 260, 269, 300);
line(251, 260, 230, 300);

x = - 90;
y = - 90;



};


All I need to do is make this image of a superhero fly. Halp pl0x

This post was edited by Shakti on Sep 12 2016 09:33pm
Member
Posts: 16,404
Joined: Mar 28 2009
Gold: 7.69
Sep 12 2016 10:47pm
I restarted and made it easier on myself. So I can get the head to move, how can I allow the red cape to follow along? Do I need to make new variables for all 6 coordinates of the triangle? Surely theres gotta be an easier way
Code
var xPos = 250;
var yPos = 200;

draw = function() {
background(113, 230, 230);

//grass
noStroke();
fill(25, 204, 61);
rect(0, 300, 410, 300);

//cape
fill(255, 0, 0);
triangle(210, 230, 250, 200, 290, 230);

//ghost hero
fill(20, 18, 18);
ellipse(xPos, yPos, 30, 30);

xPos = xPos-4;
yPos = yPos-4;


};


This post was edited by Shakti on Sep 12 2016 10:48pm
Member
Posts: 16,404
Joined: Mar 28 2009
Gold: 7.69
Sep 12 2016 10:53pm
*shrug* This works but idk feels sloppy as hell

Code
var xPos = 250;
var yPos = 200;

var x_one = 210;
var y_one = 230;

var x_two = 250;
var y_two = 200;

var x_three = 290;
var y_three = 230;

draw = function() {
background(113, 230, 230);

//grass
noStroke();
fill(25, 204, 61);
rect(0, 300, 410, 300);

//cape
fill(255, 0, 0);
triangle(x_one, y_one, x_two, y_two, x_three, y_three);

//ghost hero
fill(20, 18, 18);
ellipse(xPos, yPos, 30, 30);

xPos = xPos-4;
yPos = yPos-4;

x_one = x_one-4;
y_one = y_one-4;

x_two = x_two-4;
y_two = y_two-4;

x_three = x_three-4;
y_three = y_three-4;

};
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll