AniLevelView.h 1.24 KB
//
//  AniLevelView.h
//  HalloweenSpaceInvaders
//
//  Created by Katarzyna Kalinowska-Górska on 27/09/2019.
//

#ifndef AniLevelView_h
#define AniLevelView_h

#include "cocos2d.h"
#include <string>
#include "AniLayoutObject.h"

class AniLevelView : public cocos2d::Node, public AniLayoutObject {

public:
    static AniLevelView* create(std::string levelImagePath);
    static AniLevelView* create(std::string levelImagePath, std::string levelName);
    void setChosen(bool chosen, bool animated = true);
    void changePicture(std::string newPicturePath);
    
    virtual void loadPropertiesFromJSON(const rapidjson::Value& jsonValue, AniLayoutViewInterface* scene = NULL, const std::string resFolder = "", const std::string altResFolder = "") override;
    
    void startFloating();
    void stopFloating();
    virtual void doFloat(bool start = false);
//    void flash();
    void startAnimatingLevelPicture();
    
protected:
    bool _isChosen;
    bool _isFloating;
    int _floatDirection;
    cocos2d::Point _circleMidPoint;
    cocos2d::Sprite* _bgNode;
    cocos2d::Sprite* _pic;
    cocos2d::Label* _label;
    
    bool init(std::string levelImagePath);
    bool init(std::string levelImagePath, std::string levelName);
};


#endif /* AniLevelView_h */