I do a snake and ladders for school and it's really hard !!!
I loaded all the images (i think it's ok but i'm not sure). I've two dice. If the dice does 6, the first player go on the case 6. I need that the 6th illustration and the 6th text comes on the stage.
Somebody can help me ? I hope my english isn't so bad...
class Dice { String[] allFaces; int currentValue = 0; int rollRate = 100; int nextFlip; int x, y; //position color c; //couleur des points int state; //0 standby, 1=start lancer, 2=fin de lancer
class Pion { float x; float y; float nx, ny; //new position a atteindre int joueur; int pos; //numero de la case ou le pion se trouve int posToGo; Boolean startAnim=false; Pion(int joueur0) { joueur=joueur0; if (joueur==1) { x=27; y=687; } else { x=67; y=687; } nx=x; ny=y; } void moveTo(int nextCase) {//numero de la case, 1ere case=0 if (nextCase>=cases.length) { println("fin de parcours"); return; } nx = cases[nextCase*2]; ny = cases[nextCase*2+1]; pos = nextCase; } void move(int n) {//avance de n cases moveTo(pos+n); } void moveAnim(int n) {//avance de n cases pas par pas posToGo = pos+n; startAnim=true; nextPosition(); } void nextPosition() { moveTo(pos+1); } void display() { if (abs(nx-x)>.5 | abs(ny-y)>.5) {//anim nextposition x += (nx-x)/10.0; //anim par relaxation y += (ny-y)/10.0; } else if (startAnim=true & pos!=posToGo) { nextPosition(); } else if (startAnim=true & pos==posToGo) { startAnim=false; } if (joueur==1) { image(jeton1, x, y); } else { image(jeton2, x,y); } } }
Hi everybody ! I'm new here and i begin with processing. First, sorry for my english, i'm french.
I do a video game with processing. It's a snakes and ladders (jeu de l'oie in french). I think i need a random with video for the dice. So, i did six animations for the dice (1,2,3,4,5,6). I search help on internet and i found nothing about it. Someone have an idea ? Is it a good idea ? Someone know how i can do ?