Exemple #1
0
UpDown GetKS(const char *name)
{
    auto ks = keymap.find(name);
    if (ks == keymap.end()) return UpDown();
    #if defined(__IOS__) || defined(ANDROID)    // delayed results by one frame, that way they get 1 frame over finger hovering over target, which makes gl_hit work correctly
        return ks->second.lastframe;
    #else
        return ks->second;
    #endif
}
Exemple #2
0
UpDown GetKS(const char *name)
{
    auto ks = keymap.find(name);
    if (ks == keymap.end()) return UpDown();
    #if defined(__IOS__) || defined(__ANDROID__)
        // delayed results by one frame, that way they get 1 frame over finger hovering over target,
        // which makes gl_hit work correctly
        // FIXME: this causes more lag on mobile, instead, set a flag that this is the first frame we're touching,
        // and make that into a special case inside gl_hit
        return ks->second.lastframe;
    #else
        return ks->second;
    #endif
}
void ModulePlayer::ThrowWall(Looking direction, Collider* c){

	p2Point<int> tmp;
	tmp.x = c->rect.x;
	tmp.y = c->rect.y;

	switch (direction)
	{
	case upD:
		switch (RightLeft(tmp))
		{
		case 0:	//left
			//GO UP LEFT
			position.x = tmp.x - 16;
			position.y = tmp.y + 28;
			return;
			break;
		case 2: //right
			//GO UP RIGHT
			position.x = tmp.x + 16;
			position.y = tmp.y + 28;
			return;
			break;
		}
		break;
	case downD:
		switch (RightLeft(tmp))
		{
		case 0:	//Left
			//GO DOWN LEFT
			position.x = tmp.x - 16;
			position.y = tmp.y + 4;
			return;
			break;
		case 2: //Right
			//GO DOWN RIGHT
			position.x = tmp.x + 16;
			position.y = tmp.y + 4;
			return;
			break;
		}
		break;
	case rightD:
		switch (UpDown(tmp))
		{
		case 0:	//Up
			//RIGHT UP
			position.x = tmp.x - 12;
			position.y = tmp.y;
			return;
			break;
		case 2: //Down
			//RIGHT DOWN
			position.x = tmp.x - 12;
			position.y = tmp.y + 32;
			return;
			break;
		}
		break;
	case leftD:
		switch (UpDown(tmp))
		{
		case 0:	//Up
			//left UP
			position.x = tmp.x + 12;
			position.y = tmp.y;
			return;
			break;
		case 2: //Down
			//left DOWN
			position.x = tmp.x + 12;
			position.y = tmp.y + 32;
			break;
		}
		break;
	}
	position = last_position;

}