Exemplo n.º 1
0
void MapLayer::SetNavigationString(){
    float option = 0.0f;
    MapObject *obj = (MapObject*)this->getChildByTag(mouseY*width+mouseX);
    if(obj)
        option = obj->GetInfo().option;
    if(isEraser)
        navigation->setString(StringUtils::format("<mapEdit>\ncurser : %d\nerase : true\nposition : (%d,%d)\nnumber : %d\noption : %.1f", nowTile, mouseX, mouseY, mapData[mouseY][mouseX], option));
    else
        navigation->setString(StringUtils::format("<mapEdit>\ncurser : %d\nerase : false\nposition : (%d,%d)\nnumber : %d\noption : %.1f", nowTile, mouseX, mouseY, mapData[mouseY][mouseX], option));
}
Exemplo n.º 2
0
void MapLayer::OpenGate(){
    float range = 300;
    MapObject *gate = nullptr;
    auto jeje = JeJe::GetInstance();
    
    for(MapObject *obstacle : obstacleList){
        MapObjectInfo info = obstacle->GetInfo();
        if(info.number == 20 && GetDistance(obstacle->getPosition(), jeje->getPosition()) < range){
            gate = obstacle;
        }
    }
    
    if(gate && ((Gate*)gate)->Open(jeje->HasBlue(), jeje->HasPurple(), jeje->HasRed())){
        MapObjectInfo info = gate->GetInfo();
        auto act1 = MoveBy::create(1.0f, Vec2(0, TILE_SIZE*2));
        gate->runAction(act1);
        mapData[info.y][info.x] = 0;
        mapData[info.y+1][info.x] = 0;
    }
}