Computer Science Canada Quick Animation Loop question! |
Author: | sarah_xoxo [ Mon Dec 09, 2013 10:17 pm ] |
Post subject: | Quick Animation Loop question! |
okay i have this code of a stick man jumping once but i need to make him jump 20 times, so how do i do this using loop? i tried many ways but im stuck! setscreen ("graphics") drawfillbox (55,75, 70, 0, blue)%one of two legs of the trampoline drawfillbox (255,75, 240, 0, blue)% one of two legs of the trampoline drawline (0,230,630,230,black)%line seperating the floor and wall drawfilloval (150, 70, 121, 46, black)% black outline of trampoline drawfilloval (150, 70, 120, 45, blue)%blue outline of trampoline drawfilloval (150, 70, 110, 35, 42)% orange inner part of trampoline drawfillbox (10,235, 100, 390, 208)% door drawfilloval (80, 300, 5, 13, grey)% doorknob drawfillbox (450,235, 400, 350, 245)% one of three windows drawfillbox (525,235, 475, 350, 245)% one three windows drawfillbox (600,235, 550, 350, 245)% one of three windows drawfilloval (150, 190, 30, 35, 90)% head of stickman drawfillarc (137,197, 7, 6, 0, 180, black)% left eye outline drawfillarc (137,197, 6, 5, 0, 180, white)% inner part of left eye drawfillarc (163,197, 7, 6, 0, 180, black)%right eye outline drawfillarc (163,197, 6, 5, 0, 180, white)% inner part of left eye drawfillarc (147,180, 7, 6, 180, 0, black)% smile drawfilloval (164, 199, 2, 2, black)%iris of eye drawfilloval (137, 199, 2, 2, black)%iris of eye drawline (150,155,150,70,black)% body of stickman drawline (110,75,150,130,black)% left hand drawline (180,75,150,130,black)% right hand drawline (110,25,150,70,black)%left leg drawline (185,25,150,70,black)%right leg delay (1000) cls drawfillbox (55,75, 70, 0, blue)%one of two legs of the trampoline drawfillbox (255,75, 240, 0, blue)% one of two legs of the trampoline drawline (0,230,630,230,black)%line seperating the floor and wall drawfilloval (150, 70, 121, 46, black)%outline of complete trampoline drawfilloval (150, 70, 120, 45, blue)%blue outline of trampoline drawfilloval (150, 70, 110, 35, 42)% orange inner part of trampoline drawfillbox (10,235, 100, 390, 208)% door drawfilloval (80, 300, 5, 13, grey)% door knob drawfillbox (450,235, 400, 350, 245)% one of three windows drawfillbox (525,235, 475, 350, 245)% one of three windows drawfillbox (600,235, 550, 350, 245)% one of three windows drawfilloval (150, 240, 31, 36, black)%outline of stickman's head drawfilloval (150, 240, 30, 35, 90)% head of stickman drawfillarc (137,247, 7, 6, 0, 180, black)%left eye drawfillarc (137,247, 6, 5, 0, 180, white)%left eye drawfillarc (163,247, 7, 6, 0, 180, black)%right eye drawfillarc (163,247, 6, 5, 0, 180, white)%right eye drawfillarc (147,230, 7, 6, 180, 0, black)% mouth drawfilloval (164, 249, 2, 2, black)% iris of eye drawfilloval (137, 249, 2, 2, black)%iris of eye drawline (150,105,150,200,black)% body of stickman drawline (110,185,150,140,black) %right leg drawline (180,185,150,140,black)%l drawline (110,125,150,105,black) drawline (185,125,150,105,black) |
Author: | Raknarg [ Mon Dec 09, 2013 10:31 pm ] |
Post subject: | RE:Quick Animation Loop question! |
So basically what we're trying to do is just repeat these lines of code 20 times right? Do you understand how a for loop works, or would you like me to explain? |
Author: | sarah_xoxo [ Tue Dec 10, 2013 6:38 am ] |
Post subject: | RE:Quick Animation Loop question! |
i understand how a loop works but not a counted loop, so yes it would be so helpful if you explained |
Author: | Raknarg [ Tue Dec 10, 2013 10:00 am ] |
Post subject: | RE:Quick Animation Loop question! |
Ok, so a for loop is just a loop that only runs a set amount of times. Not only that, but the loop it is currently on is kept track of, so you can do things with it. for i : 1 .. 10 % code goes in here end for It's that simple. This loop will run the code inside it 10 times, and each time i will be a number from 1 to 10. Makes sense? Also, i can be anything you want. If you want i to be count instead, you can do that. for flibbitygibber : 1 .. 10 is also a valid loop. |
Author: | locothecoco [ Fri Nov 20, 2015 2:13 pm ] |
Post subject: | RE:Quick Animation Loop question! |
can anyone help me with turing please i dont know how to make drawline fuctions |
Author: | TokenHerbz [ Mon Nov 23, 2015 12:49 pm ] |
Post subject: | RE:Quick Animation Loop question! |
@locothecoco http://compsci.ca/v3/viewtopic.php?t=376 |