xxxxxxxxxx
66
class state{
constructor(n,l,m,x,y){
this.n=n
this.l=l
this.m=m
this.x=x
this.y=y
}
}
let img
let x=0
let y=0
let s=[]
function setup() {
createCanvas(400, 300);
for(let i=2;i<5;i++){
for(let j=0;j<i;j++){
for(let k=0;k<j+1;k++){
s.push(new state(i,j,k,0,0))
}
}
}
s[1].y=1
s[2].y=2
s[3].x=1
s[4].x=1
s[4].y=1
s[5].x=2
s[5].y=1
s[6].x=1
s[6].y=2
s[7].x=2
s[7].y=2
s[8].x=3
s[8].y=2
s[9].y=3
s[10].x=1
s[10].y=3
s[11].x=2
s[11].y=3
s[12].x=3
s[12].y=3
s[13].x=4
s[13].y=3
s[14].y=4
s[15].x=1
s[15].y=4
s[16].x=2
s[16].y=4
s[17].x=3
s[17].y=4
s[18].x=4
s[18].y=4
img=loadImage('/images/Hyd.png')
}
function draw() {
background(220);
if(keyIsDown(32)){
x=int(random(0,4))
y=int(random(x,4))
}
image(img,-400*x,-400*y)
if(keyIsDown(13)){
print(x+','+y)
}
}