Difference between revisions of "Yesterday"
From CodeStuff
(Created page with "Useful things to refer to. *Variables *If statements *Coordinates *Keycodes The API page has a list of some of the functions you can use such as *[...") |
|||
| Line 5: | Line 5: | ||
*[[Coordinates]] | *[[Coordinates]] | ||
*[[Keycodes]] | *[[Keycodes]] | ||
| − | + | *[[Functions]] | |
The [[API|API page]] has a list of some of the functions you can use such as | The [[API|API page]] has a list of some of the functions you can use such as | ||
| Line 19: | Line 19: | ||
var maryx=200; | var maryx=200; | ||
var maryy=240; | var maryy=240; | ||
| + | |||
| + | var frankx=380; | ||
| + | var franky=240; | ||
var power=0.1; | var power=0.1; | ||
| Line 25: | Line 28: | ||
var lastx=cx; | var lastx=cx; | ||
var lasty=cy; | var lasty=cy; | ||
| + | |||
| + | function drawSpot(x,y) { | ||
| + | setColour("red"); | ||
| + | fillCircle(x,y,10); | ||
| + | setColour("yellow"); | ||
| + | fillCircle(x,y,7); | ||
| + | |||
| + | } | ||
function move() { | function move() { | ||
| Line 88: | Line 99: | ||
maryx-=0.3; | maryx-=0.3; | ||
} | } | ||
| + | |||
| + | //move frank towards cx,cy | ||
| + | if (franky < cy) { | ||
| + | franky+=0.3; | ||
| + | } | ||
| − | if ( | + | if (franky > cy) { |
| − | + | franky-=0.3; | |
} | } | ||
| + | if (frankx <cx) { | ||
| + | frankx+=0.3; | ||
| + | } | ||
| + | |||
| + | if (frankx > cx) { | ||
| + | frankx-=0.3; | ||
| + | } | ||
| + | |||
| + | clear(); | ||
setColour("purple"); | setColour("purple"); | ||
fillCircle(cx,cy,penSize); | fillCircle(cx,cy,penSize); | ||
| − | + | drawSpot(maryx,maryy); | |
| − | + | drawSpot(frankx,franky); | |
| − | + | ||
} | } | ||
run(move); | run(move); | ||
| + | |||
</edcode> | </edcode> | ||
Latest revision as of 11:34, 29 June 2017
Useful things to refer to.
The API page has a list of some of the functions you can use such as