Ejemplo n.º 1
0
Int2 Questioner::doPanning(Int2 targetPan, int timetaken)
{
	if(timetaken > TIME_TO_SCROLL)
	{
		myGameDrawer->doPanning(myCube, targetPan);
		return targetPan;
	}

	float panningPropTimeLeft = (TIME_TO_SCROLL - timetaken) / (float) TIME_TO_SCROLL;
	
	Float2 diffPan = vec((float) 0, panningPropTimeLeft * PIXEL_SCROLL);
	Float2 newPan = targetPan + diffPan;

	myGameDrawer->doPanning(myCube, newPan.round());

	return newPan.round();
}
Ejemplo n.º 2
0
	void update(TimeDelta timeStep)
	{
		//LOG("Update");
		if (whichGame == 0)
		{
			cubeVideo[cube].bg0.image(vec(0,0), BackgroundXTwo);
		}
		else if (whichGame == 1)
		{
			cubeVideo[cube].bg0.image(vec(0,0), BackgroundYTwo);
		}
		
		writeScore(shakeScore);

		Int2 accel = cubeVideo[cube].physicalAccel().xy();
		float delta;
		
		if (whichGame == 0)
		{
			delta = accel.x - lastAccel.x;
		}
		else if (whichGame == 1)
		{
			delta = accel.y - lastAccel.y;
		}
        
		delta = Sifteo::abs(delta);
		
		shakeCounter += delta;
		
		if (shakeCounter > 1000)
		{
			shakeCounter -= 1000;
			shakeScore++;
		}
				
		lastAccel = accel;
        
        cubeVideo[cube].bg1.setPanning(text.round());
	}