Esempio n. 1
0
Crate::Crate(b2World* world, RenderWindow* win, float x, float y, float w, float h) : MovableObject(world,win,x,y,w,h)
{
	m_weight = 3.0f;
	createBox2dBody();
	loadAssets();

}
Esempio n. 2
0
void Item::Dropped(Vector2f pos) {
	onGround = true;
	inHotBar = false;
	hotbarSlot = -1;
	m_sprite.setScale(Vector2f(0.2, 0.2));
	m_sprite.setPosition(pos);
	createBox2dBody();
	body->SetTransform(b2Vec2(m_sprite.getPosition().x / SCALE, m_sprite.getPosition().y / SCALE), 0);
}
Esempio n. 3
0
Bullet::Bullet(b2World* world, float x, float y, bool player) : m_world(world), bulletForPlayer1(player)
{
	alive = false;
	reset = false;
	createBox2dBody(x, y);
	resetPos = b2Vec2(-5000, 0);
	LoadAssets(x, y);
	currentDirection = NOTMOVING;

	bullet1 = player;
}
Esempio n. 4
0
bool Bird::initWithWorld( b2World* world )
{
	if (!Sprite::initWithFile("bird.png"))
		return false;
	CCASSERT(world != nullptr, "b2 world null");
	_world = world;

	createBox2dBody();

	this->setAnchorPoint(ccp(0.5f, 0.5f));
	this->setScale(0.5f);
	return true;
}
Esempio n. 5
0
Container::Container(Vector2f pos, float rot, std::vector<Item*>* i, int t) :
	m_pos(pos), rotation(rot), items(i)
{
	type = t;
	open = false;
	invCols = 4;
	invRows = 5;
	invSize = 20;
	LoadAssets();
	SetupSlots();
	GenerateItems();
	createBox2dBody();
}
Esempio n. 6
0
Door::Door(b2World* world, RenderWindow* win, float x, float y, float w, float h) : m_world(world), m_win(win), position(x, y), size(w, h)
{
	rotatingDoor = false;
	createBox2dBody();
	loadAssets();
}
Esempio n. 7
0
//debugging constructor
Item::Item(ItemType t, int s, bool g, Vector2f pos) : type(t), size(s) {
	onGround = g;
	m_pos = pos;
	LoadAssets();
	createBox2dBody();
} 
Esempio n. 8
0
Hazard::Hazard(b2World* world, RenderWindow* win, float x, float y, float w, float h) : m_world(world), m_win(win), startPosition(x, y), size(w, h)
{
	createBox2dBody();
	loadAssets();
}
Esempio n. 9
0
Tree::Tree(Vector2f pos) : m_pos(pos)
{
	LoadAssets();
	createBox2dBody();
}