File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*
2+ ** Society: Creative Rift
3+ ** SHIPWRECK ENGINE, 2022
4+ ** Author: Guillaume S.
5+ ** File name: Opossum.hpp
6+ ** Description: [CHANGE]
7+ */
8+
9+ #ifndef INCARIBUS_HOUSE_HPP
10+ #define INCARIBUS_HOUSE_HPP
11+
12+ #include " SW/Component.hpp"
13+ #include " SW/Utils.hpp"
14+
15+ namespace inc
16+ {
17+ class House : public sw ::Component
18+ {
19+ public:
20+ explicit House (sw::Entity& entity);
21+ void start ();
22+ }; // class House
23+ } // namespace inc
24+
25+ #endif // INCARIBUS_HOUSE_HPP
Original file line number Diff line number Diff line change 7575 " Main"
7676 ],
7777 "Type" : " Texture"
78+ },
79+ "House" : {
80+ "Path" : " resources/textures/house.png" ,
81+ "Scene" : [
82+ " Main"
83+ ],
84+ "Type" : " Texture"
7885 }
7986}
Original file line number Diff line number Diff line change 1616#include " script/Opossum.hpp"
1717#include " script/Gem.hpp"
1818#include " script/Frog.hpp"
19+ #include " script/House.hpp"
1920
2021void Main::onLoad ()
2122{
@@ -33,6 +34,7 @@ void Main::onLoad()
3334 auto & opossum = createEntity (" Opossum" );
3435 auto & gem = createEntity (" Gem" );
3536 auto & frog = createEntity (" Frog" );
37+ auto & house = createEntity (" House" );
3638 sw::ConcreteComponent auto & camera = mainCamera.createComponent <sw::Camera>(" CameraManager" );
3739 sw::ConcreteComponent auto & camTrans = mainCamera.createComponent <sw::Transform>(" TransformManager" );
3840 std::string foo (" MapMenu" );
@@ -44,6 +46,7 @@ void Main::onLoad()
4446 opossum.createComponent <inc::Opossum>(" ScriptManager" );
4547 gem.createComponent <inc::Gem>(" ScriptManager" );
4648 frog.createComponent <inc::Frog>(" ScriptManager" );
49+ house.createComponent <inc::House>(" ScriptManager" );
4750
4851 entity.createComponent <inc::BackgroundManager>(" ScriptManager" );
4952 camera.setClippingNear (-1 );
Original file line number Diff line number Diff line change @@ -27,6 +27,6 @@ void inc::Cherry::start()
2727 transform.setPosition (1400 , 250 );
2828 transform.setScale (3 .0f , 3 .0f );
2929 sprite.setTexture (ye);
30- m_entity.setLayer (" SpriteManager" , 1 );
30+ m_entity.setLayer (" SpriteManager" , 2 );
3131 animator.setRect ({21 , 21 }).setLoop (true ).setFPS (8 ).play ();
3232}
Original file line number Diff line number Diff line change @@ -27,6 +27,6 @@ void inc::Frog::start()
2727 transform.setPosition (1000 , 735 );
2828 transform.setScale (2 .5f , 2 .5f );
2929 sprite.setTexture (ye);
30- m_entity.setLayer (" SpriteManager" , 1 );
30+ m_entity.setLayer (" SpriteManager" , 2 );
3131 animator.setRect ({35 , 32 }).setLoop (true , 5 ).setFPS (6 ).play ();
3232}
Original file line number Diff line number Diff line change @@ -27,6 +27,6 @@ void inc::Gem::start()
2727 transform.setPosition (1300 , 760 );
2828 transform.setScale (2 .5f , 2.5 );
2929 sprite.setTexture (ye);
30- m_entity.setLayer (" SpriteManager" , 1 );
30+ m_entity.setLayer (" SpriteManager" , 2 );
3131 animator.setRect ({15 , 13 }).setLoop (true ).setFPS (8 ).play ();
3232}
Original file line number Diff line number Diff line change 1+ /*
2+ ** Society: Creative Rift
3+ ** SHIPWRECK ENGINE, 2022
4+ ** Author: Guillaume S.
5+ ** File name: Opossum.cpp
6+ ** Description: [CHANGE]
7+ */
8+
9+ #include " script/House.hpp"
10+ #include " components/Transform.hpp"
11+ #include " components/Sprite.hpp"
12+
13+ inc::House::House (sw::Entity &entity) :
14+ sw::Component(entity)
15+ {
16+ entity.scene ().eventManager ()[" Start" ].subscribe (this , &inc::House::start);
17+ }
18+
19+ void inc::House::start ()
20+ {
21+ sw::ConcreteComponent auto & transform = m_entity.createComponent <sw::Transform>(" TransformManager" );
22+ sw::ConcreteComponent auto & sprite = m_entity.createComponent <sw::Sprite>(" SpriteManager" );
23+ std::string ye (" House" );
24+
25+ transform.setPosition (500 , 532 );
26+ transform.setScale (2.5 , 2.5 );
27+ sprite.setTexture (ye);
28+ m_entity.setLayer (" SpriteManager" , 1 );
29+ }
Original file line number Diff line number Diff line change @@ -40,13 +40,13 @@ void inc::Opossum::update()
4040 sw::ConcreteComponent auto & sprite = m_entity.getComponent <sw::Sprite>(" SpriteManager" );
4141
4242 if (m_direction == LEFT) {
43- transform.move (-5 , 0 );
43+ transform.move (-4 , 0 );
4444 if (transform.getPosition ().x <= m_pos1.x ) {
4545 m_direction = RIGHT;
4646 sprite.invertX (true );
4747 }
4848 } else {
49- transform.move (5 , 0 );
49+ transform.move (4 , 0 );
5050 if (transform.getPosition ().x >= m_pos2.x ) {
5151 m_direction = LEFT;
5252 sprite.invertX (false );
You can’t perform that action at this time.
0 commit comments