#include "noid.h"

	

#define BeanUN 50
#define BeanLUN 53
#define BeanMUN 52
#define BeanRUN 51

#define BeanEU 54
#define BeanLEU 57
#define BeanMEU 56
#define BeanREU 55

void GoTrance(void);
void SpielLEVELONE(void);
void NoidSpielRESUME(void);
void MenuMENU(void);
void MenuQUIT(void);

//==============================================
//====================================================
float HmoveTWO = 0.01;float VmoveTWO = 0.01;

void BeanEUmove(void) {
	if ((noid[BeanMEU].x > 0.8) || (noid[BeanMEU].x < -0.8))	{	HmoveTWO = 0-HmoveTWO;	}
	if ((noid[BeanMEU].y > 0.8) || (noid[BeanMEU].y < -0.8))	{	VmoveTWO = 0-VmoveTWO;	}
	noid[BeanMEU].x = noid[BeanMEU].x + HmoveTWO;    
	noid[BeanMEU].y = noid[BeanMEU].y + VmoveTWO;
	noid[BeanREU].x = noid[BeanREU].x + HmoveTWO;    
	noid[BeanREU].y = noid[BeanREU].y + VmoveTWO;
	noid[BeanLEU].x = noid[BeanLEU].x + HmoveTWO;    
	noid[BeanLEU].y = noid[BeanLEU].y + VmoveTWO;
	}

void BeanGibbEU(void){
 	noid[BeanMEU].jeton = 32;
	noid[BeanMEU].click = 0;
	noid[BeanMEU].timer = 0;
	noid[BeanREU].timer = 0;
	noid[BeanLEU].timer = 0;
	noid[BeanREU].jeton = 0;
	noid[BeanLEU].jeton = 0;
	noid[BeanEU].timer = 0;
	}


int deleftEU = 1;
int degonfleEU = 1;
int derightEU = 1;

void BeanAnimEU(void) {
	if ((noid[BeanMEU].x > 0.8) || (noid[BeanMEU].x < -0.8))	{	HmoveTWO = 0-HmoveTWO;	}
	if ((noid[BeanMEU].y > 0.8) || (noid[BeanMEU].y < -0.8))	{	VmoveTWO = 0-VmoveTWO;	}
	noid[BeanMEU].x = noid[BeanMEU].x + HmoveTWO;    
	noid[BeanMEU].y = noid[BeanMEU].y + VmoveTWO;
	noid[BeanREU].x = noid[BeanMEU].x;    
	noid[BeanREU].y = noid[BeanMEU].y;
	noid[BeanLEU].x = noid[BeanMEU].x;    
	noid[BeanLEU].y = noid[BeanMEU].y;

		noid[BeanMEU].jeton = noid[BeanMEU].jeton + degonfleEU;
		noid[BeanREU].jeton = noid[BeanREU].jeton + derightEU;
		noid[BeanLEU].jeton = noid[BeanLEU].jeton + deleftEU;

		if (noid[BeanMEU].jeton >= 67) {	noid[BeanMEU].jeton = 66;
							degonfleEU = 0 - degonfleEU;		}
		if (noid[BeanMEU].jeton <= 62) {	noid[BeanMEU].jeton = 63;
							degonfleEU = 0 - degonfleEU;		}
		if (noid[BeanREU].jeton >= 44) {	noid[BeanREU].jeton = 43;
							derightEU = 0 - derightEU;		}
		if (noid[BeanREU].jeton <= 41) {	noid[BeanREU].jeton = 42;
							derightEU = 0 - derightEU;		}
		if (noid[BeanLEU].jeton >= 42) {	noid[BeanLEU].jeton = 41;
							deleftEU = 0 - deleftEU;		}
		if (noid[BeanLEU].jeton <= 39) {	noid[BeanLEU].jeton = 40;
							deleftEU = 0 - deleftEU;		}

	//}

}

//====================================================
void SpielLEVELONE(void) {
	GoTrance();
	layer.active = 6;
	noid[eEXIT].evenback = &MenuQUIT;

		noid[BeanMEU].clikback = &BeanGibbEU;
		noid[BeanMEU].layer = 6;
		noid[BeanMEU].timeback = &BeanAnimEU;
		noid[BeanMEU].click = 1;
		noid[BeanMEU].timer = 60;
		noid[BeanMEU].jeton = 60;
		noid[BeanMEU].x = 0.5;
		noid[BeanMEU].y = -0.2;

		noid[BeanREU].layer = 6;
		noid[BeanREU].jeton = 55;
		noid[BeanREU].x = noid[BeanMEU].x;
		noid[BeanREU].y = noid[BeanMEU].y;

		noid[BeanLEU].layer = 6;
		noid[BeanLEU].jeton = 50;
		noid[BeanLEU].x = noid[BeanMEU].x;
		noid[BeanLEU].y = noid[BeanMEU].y;

	}
