Results 1 to 4 of 4
Thread: Need help with my code
- 10-22-2012, 06:27 AM #1
Member
- Join Date
- Oct 2012
- Posts
- 1
- Rep Power
- 0
Need help with my code
If you run the code in a java program, you can see the background rotating, but not harry. Can someone edit the code so harry is also rotating?
Harry's coding starts at line 135
Java Code:////////////// // //Assignment 1 // // //20120917 // //Harry Potter Drawing // //gloval variables float angDeg;//angle in degrees float angRad;//angle in radians int fc;//frame counter...line time //runs once when the app first starts void setup() { angRad = 0;//angle at 0 fc = 0;//no time has passed yet size(640,480);//sets the app size background(58,255,0);//lime green smooth();//draw smooth } //runs all the time, this is the main app loop void draw () { { background(58,255,0);//lime green drawGryffindorColorsPattern(); resetMatrix();//Harry won't rotate } { if(mouseY<240) drawHarry();// angDeg+=0.4; } } void drawGryffindorColorsPattern()//draw Gryffindor colors pattern { angRad = radians(angDeg);//converts 45 deg to radians angDeg-= 0.1;//rotate Pattern at this angle translate(mouseX,mouseY); rotate(angDeg);//the rotation of the pattern float rad;//temp number of radians rad=(45);//convert deg to radians rad=radians(mouseY);//convert to radians rotate(rad); //draw pattern unit horz line down manny times for(int j=-10; j < 30; j++) { //entire horz line of units //draw pattern unit across this many times for (int i=-10; i < 30; i++) { //code we want repeated drawPatternUnit(i*100, j*100); } } } //drawPatternUnit void drawPatternUnit(int xxx, int yyy) { pushMatrix();//isolate transformations //transformations will happen in reverse translate (xxx,yyy);//move the drawing by given amount fill(255,0,0); stroke(255,0,0); strokeWeight(0); rect(0,0,100,100); //fill(255,0,0);//red //rect(0,0,90,90);//100x100 square //fill(0,0,0);//black //rect(15,15,70,70); fill(0,0,0);//black rect(20,20,60,60);// fill(255,255,255);//white rect(25,25,50,50);//rectangle in middle //stroke(0,0,0);//black //rect(30,30,40,40);// stroke(255,164,15);//golden yellow strokeWeight(1);//thin line line(50,0,50,100);//vertical line stroke(255,164,15);//golden yellow strokeWeight(1);//thin line line(0,50,100,50);//vertical line stroke(255,164,15);//golden yellow strokeWeight(1);//thin line line(0,0,100,100);//vertical line stroke(255,164,15);//golden yellow strokeWeight(1);//thin line line(0,100,100,0);//vertical line fill(0,0,0);//black ellipse(50,50,15,15);//circle in the middle fill(0,0,0);//black ellipse(0,50,15,15);//circle in the middle fill(0,0,0);//black ellipse(50,0,15,15);//circle in the middle fill(0,0,0);//black ellipse(50,100,15,15);//circle in the middle fill(0,0,0);//black ellipse(100,50,15,15);//circle in the middle popMatrix();//finished isolating } //draw Harry void drawHarry() { rotate(radians(45)); translate (50,0); //robe 1 noStroke(); fill(0,0,0);//black fill rect(244.44,230,73,276);//black robe //neck strokeWeight(0);//no stroke fill(229,171,134);//skin color rect(244.4,115,37.8,120);//first half of neck //neck 2 strokeWeight(0);// no stroke fill(229,171,134);//skin color rect(280,140,37.8,120);//second half of neck //hair behind ears fill(0,0,0);//black ellipse(240,145,64.0,110);//hair behind ear //ears fill(222,143,121);//skin color ellipse(238,168,40.7,40.7);//ear //face strokeWeight(0);//no stroke fill(249,200,174);//skin color ellipse(296.8,150,122.2,160);//face //nose stroke strokeWeight(1);//thin stroke stroke(201,76,69);//dark skin color line(325.9,138,331.7,162);//tilted line //nostril underline 1 noStroke();//no stroke fill(236,166,148);//dark skin color ellipse(320,174,7,8);//nose shadow //nostril 1 noStroke();//no stroke fill(0,0,0);//black ellipse(320,174,5.82,3.6);//nostril //nostril underline 1 noStroke();//no stroke fill(236,166,148);//dark skin color ellipse(331.7,174,7,8);//nose shadow //nostril 2 noStroke();//no stroke fill(0,0,0);//black ellipse(331.7,174,5.23,3.6);//nostril //eyebrow 1 stroke(110,56,44);//brown strokeWeight(5);//medium stroke line(285.2,120,308.5,120);//eyebrow //eyebrow 1.1 stroke(110,56,44);//brown strokeWeight(5);//medium stroke line(285.2,120,273.5,125);//eyebrow //eyebrow 2 stroke(110,56,44);//brown strokeWeight(5);//medium stroke line(330,120,350,120);//eyebrow //eyebrow 2.1 stroke(110,56,44);//brown strokeWeight(5);//medium stroke line(285.2,120,273.5,125);//eyebrow //glasses1 stroke (0,0,0);//black strokeWeight(1);//thin line fill (249,200,174);//skin color ellipse(296.8,138,34.92,36);//glasses //pocket under eye 1 fill(232,166,148);//darker skin color ellipse(291,138, 17.46, 17);//shading under eye //white eye 1 fill(255,255,255);//white ellipse(291,138, 17.46, 12);//white eye //pupil 1 fill(77,105,138);//blue ellipse (291,138, 11.6,12);//blue pupil //pupil black 1 fill(0,0,0);//black ellipse (288.5,137,5.82,6);//black inner pupil //pupil white 1 fill(255,255,255);//white ellipse (290,137,2.4,2.4);//white shine in eye //glasses 2 stroke (0,0,0);//black fill(249,200,174);//skin color ellipse(343.38,138,34.92,36);//glasses //pocket under eye 2 fill(232,166,148);//darker skin color ellipse(337.6,138, 17.46, 17);//glasses //white eye 1 fill(255,255,255);//white ellipse(337.6,138, 17.46, 12);//white eye //pupil 2 fill(77,105,138);//blue ellipse (337.6,138,11.6,12);//pupil //pupil black 2 fill(0,0,0);//black ellipse (334,137,5.82,6);//inner pupil //pupil white 2 fill(255,255,255);//white ellipse (335,137,2.4,2.4);//white shine //legs stroke(0,0,0);//black strokeWeight(3);//thin libne line (235,136, 278, 138);//leg of glasses //middle leg 1 stroke(0,0,0);//black strokeWeight(3);//thin line line(316, 138, 324,138);//leg of glasses //scar 1 stroke (232,152,148);//pink strokeWeight(2);//thin line line (302.6,84,308.5,102);//scar //scar 1 stroke (232,152,148);//pink strokeWeight(2);//thin line line (308.5,102, 296,96);//scar //scar 1 stroke (232,152,148);//pink strokeWeight(2);//thin line line (296,96, 302.6,114);//scar //middle lip line stroke (201,76,69);//pinkish red strokeWeight(2);//thin line line(296.8,192,337.6,192);//upper lip //upper lip line 1 stroke (201,76,69);//pinkish red strokeWeight(2);//thin line line(296.8,192,320.1,190);//upper lip //upper lip line 2 stroke(201,76,69);//pinkish red strokeWeight(2);//thin line line(320.1,191,323,191);//upper lip //upper lip line 3 stroke(201,76,69);//pinkish red strokeWeight(2);//thin line line(323,190,325,190);//upper lip //upper lip line 3 stroke(201,76,69);//pinkish red strokeWeight(2);//thin line line(323,190,325,190);//upper lip //upper lip line 4 stroke(201,76,69);//pinkish red strokeWeight(2);//thin line line(325,190,337.6,192);//upper lip //bottom lip line 1 stroke(201,76,69);//pinkish red strokeWeight(3);//thin line line(296.8,192,320.1,195);//bottom lip //bottom lip line 2 stroke(201,76,69);//pinkish red strokeWeight(3);//thin line line(320.1,195, 323,195);//bottom lip //bottom lip line 2 stroke(201,76,69);//pinkish red strokeWeight(3);//thin line line(323,195,337.6,192);//bottom lip //top hair noStroke();//no stroke fill(0,0,0);//black ellipse(260,60,66,50);//hair //hair oval on left strokeWeight(1);//thin line fill(0,0,0);//black ellipse(220,115,40.7,102);//hair //hair oval on top left strokeWeight(1);//thin line fill(0,0,0);//black ellipse(240,100,52.38,66);//hair //hair oval on top left 2 strokeWeight(1);//thin line fill(0,0,0);//black ellipse(245,78,64.0,66);//hair //hair center right strokeWeight(1);//thin line fill(0,0,0);//black ellipse(290,52,40.7,40);//hair //hair center right strokeWeight(1);//thin line fill(0,0,0);//black ellipse(298,54,35,35);//hair //hair center right strokeWeight(1);//thin line fill(0,0,0);//black ellipse(300,54,35,45);//hair //hair center right strokeWeight(1);//thin line fill(0,0,0);//black ellipse(310,60,35,45);//hair //hair center right strokeWeight(1);//thin line fill(0,0,0);//black ellipse(320,65,35,45);//hair //hair center right strokeWeight(1);//thin stroke fill(0,0,0);//black ellipse(330,70,35,45);//hair //hair center right strokeWeight(1);//thin stroke fill(0,0,0);//black ellipse(340,80,35,55);//hair //hair center right strokeWeight(1);//thin stroke fill(0,0,0);//black ellipse(346,85,35,55);//hair //hair front strand 1 strokeWeight(3);//medium stroke stroke(0,0,0);//black line(302.6,72,285.2,126);//hair //hair front strand 2 strokeWeight(3);//medium stroke stroke(0,0,0);//black line(300,72,285.2,126);//hair //hair front strand 3 strokeWeight(3);//medium stroke stroke(0,0,0);//black line(298,72,285.2,126);//hair //hair front strand 4 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(296,72,285.2,126);//hair //hair front strand 5 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(294,72,280,126);//hair //hair front strand 6 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(290,72,280,126);//hair //hair front strand 7 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(280,65,260,126);//hair //hair front strand 8 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(270,65,255,130);//hair //hair front strand 9 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(275,65,260,130);//hair //hair front strand 10 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(304,72,320,115);//hair //hair front strand 11 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(304,72,322,115);//hair //hair front strand 12 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(308,72,326,115);//hair //hair front strand 13 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(310,72,330,118);//hair //hair front strand 14 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(312,72,332,118);//hair //hair front strand 15 strokeWeight(5);////medium stroke stroke(0,0,0);//black line(314,72,334,118);//hair //hair front strand 16 strokeWeight(5);////medium stroke stroke(0,0,0);//black line(316,72,336,118);//hair //hair front strand 17 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(318,72,336,118);//hair //hair front strand 18 strokeWeight(6);//medium stroke stroke(0,0,0);//black line(320,72,338,118);//hair //hair front strand 18 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(322,72,338,120);//hair //hair front strand 19 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(328,72,346,120);//hair //hair front strand 20 strokeWeight(5);//medium stroke(0,0,0);//black line(329,72,348,122);//hair //hair front strand 21 strokeWeight(7);//medium stroke stroke(0,0,0);//black line(329,72,349,124);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(330,72,350,125);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(332,72,352,125);//hair //hair front strand 22 strokeWeight(5);////medium stroke stroke(0,0,0);//black line(350,72,352,125);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(352,72,352,125);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(354,72,352,125);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(356,72,355,127);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(360,80,355,129);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(361,80,355,129);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(363,83,360,129);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(363,83,360,129);//hair //hair front strand 22 strokeWeight(5);//medium stroke stroke(0,0,0);//black line(363,83,360,135);//hair //hair left strand 1 strokeWeight(10);//medium stroke stroke(0,0,0);//black line(238.6,114, 238.6, 165);//hair //hair left strand 1 strokeWeight(9);//medium stroke stroke(0,0,0);//black line(230,114, 230, 165);//hair //shoulder left noStroke();//no stroke fill(0,0,0);//black ellipse(232.8,290,98.9,132);////black part of robes //robe left noStroke();//no stroke fill(0,0,0);//black rect(183,290,99,200);//black part of robes //shoulder right noStroke();//no stroke fill(0,0,0);//black ellipse(300,325,98.9,132);//black part of robes //robe right noStroke();//no stroke fill(0,0,0);//black rect(250,325,99,200);//black part of robes //folds of robes 1 stroke(98,95,93);//grey strokeWeight(3);//thin line line(250,380,250,480);//shadow of the folds on the robes //folds of robes split stroke(98,95,93);//grey strokeWeight(3);//thin line line(250,384,255,380);//shadow of the folds on the robes //folds of robes 2 (side) stroke(98,95,93);//grey strokeWeight(2);//thin line line(182.5,350,210,360);//shadow of the folds on the robes //folds of robes 2 (side) stroke(98,95,93);//grey strokeWeight(2);//thin line line(182.5,320,200,325);//shadow of the folds on the robes //folds of robes 2 (side) stroke(98,95,93);//grey strokeWeight(2);//thin stroke line(182.5,310,200,315);//shadow of the folds on the robes //tag on robe stroke(203,150,14); //golden yellow strokeWeight(3);//thin stroke fill(193,14,14);//red fill rect(300,350,20,30);//to resemble a Gryffindor House tag //robe collar strokeWeight(20); //thick stroke stroke(255,255,255); // white line(240,220,325,276); //slanted white line, to resemble a collar resetMatrix();// }Last edited by br0k3n4rr0w; 10-22-2012 at 06:30 AM.
- 10-22-2012, 06:47 AM #2
Member
- Join Date
- Sep 2012
- Posts
- 70
- Rep Power
- 0
Re: Need help with my code
Is it just me or is there no public class?
you might want to do something like this
Java Code:public class fileName{ //all your other code }
- 10-22-2012, 06:51 AM #3
Member
- Join Date
- Sep 2012
- Posts
- 70
- Rep Power
- 0
Re: Need help with my code
also it looks like your using variables without declaring them also it almost sounds like you don't care about learning because of this quote
I think most of use prefer helping people who want to learn rather then just coding for them but I technically can't speak for everyone else but myself.Can someone edit the code so harry is also rotating?
also with your title... Guide For New MembersLast edited by killutch; 10-22-2012 at 06:54 AM.
- 10-23-2012, 03:44 PM #4
Re: Need help with my code
Or Forum Rules -- particularly the third paragraph.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
this code is not working I Dont know why ? Public void close the last code!!
By lukote04 in forum New To JavaReplies: 1Last Post: 03-25-2012, 02:40 AM -
My code was not executed properly.It will jumping to exception handling.my code is
By vinay4051 in forum EclipseReplies: 3Last Post: 08-10-2011, 09:17 AM -
servlet include method copying sorce code and executing source code as output how to
By shamkuma2k in forum Advanced JavaReplies: 0Last Post: 08-07-2011, 08:32 PM -
C server code - Java CLient Code _ TCP Connection Problem
By rmd22 in forum NetworkingReplies: 0Last Post: 02-21-2011, 11:50 AM -
Generating Code Automatically Using Custom code Template In Eclipse
By JavaForums in forum EclipseReplies: 1Last Post: 04-26-2007, 03:52 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks