feat: added truck and background to level
parent
200b621fde
commit
160306a210
|
@ -1,15 +1,18 @@
|
|||
#include "level_1.hpp"
|
||||
#include "core/node.hpp"
|
||||
#include "core/node2d.hpp"
|
||||
#include "core/sprite.hpp"
|
||||
#include "player.hpp"
|
||||
#include "scrolling_ground.hpp"
|
||||
#include "truck.hpp"
|
||||
|
||||
void Level1::instantiate() {
|
||||
root.reset(new ce::Node2D("root"));
|
||||
root->create_child<ce::Sprite>("background", "background")->set_global_transform({
|
||||
ce::Node::OwnedPtr Level1::construct() {
|
||||
ce::Node::OwnedPtr root{new ce::Node2D("root")};
|
||||
root->create_child<ScrollingGround>()->set_global_transform({
|
||||
.position = ce::Vecf::ZERO,
|
||||
.rotation = 0.f,
|
||||
.scale = ce::Vecf::ONE * 10.f
|
||||
.scale = ce::Vecf::ONE
|
||||
});
|
||||
root->create_child<Player>();
|
||||
root->create_child<Truck>(0.f);
|
||||
return std::move(root);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "core/level.hpp"
|
||||
|
||||
class Level1 : public ce::Level {
|
||||
virtual void instantiate() override;
|
||||
virtual ce::Node::OwnedPtr construct() override;
|
||||
};
|
||||
|
||||
#endif // !LEVEL_1_HPP
|
||||
|
|
Loading…
Reference in New Issue