mirror of https://github.com/axmolengine/axmol.git
Fixes some warnings
... and updates the version to pre-alpha0
This commit is contained in:
parent
ff0cbb9d0b
commit
943b805bc8
|
@ -30,7 +30,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
const char* cocos2dVersion()
|
const char* cocos2dVersion()
|
||||||
{
|
{
|
||||||
return "3.0-alpha0-pre";
|
return "3.0-pre-alpha0";
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -56,6 +56,9 @@ public:
|
||||||
ParallaxNode();
|
ParallaxNode();
|
||||||
virtual ~ParallaxNode();
|
virtual ~ParallaxNode();
|
||||||
|
|
||||||
|
// prevents compiler warning: "Included function hides overloaded virtual functions"
|
||||||
|
using Node::addChild;
|
||||||
|
|
||||||
void addChild(Node * child, int z, const Point& parallaxRatio, const Point& positionOffset);
|
void addChild(Node * child, int z, const Point& parallaxRatio, const Point& positionOffset);
|
||||||
|
|
||||||
/** Sets an array of layers for the Parallax node */
|
/** Sets an array of layers for the Parallax node */
|
||||||
|
|
|
@ -35,17 +35,18 @@ void EnemyController::onEnter()
|
||||||
|
|
||||||
|
|
||||||
// Determine speed of the target
|
// Determine speed of the target
|
||||||
int minDuration = (int)2.0;
|
int minDuration = 2;
|
||||||
int maxDuration = (int)4.0;
|
int maxDuration = 4;
|
||||||
int rangeDuration = maxDuration - minDuration;
|
int rangeDuration = maxDuration - minDuration;
|
||||||
// srand( TimGetTicks() );
|
// srand( TimGetTicks() );
|
||||||
int actualDuration = ( rand() % rangeDuration ) + minDuration;
|
int actualDuration = ( rand() % rangeDuration ) + minDuration;
|
||||||
|
|
||||||
// Create the actions
|
// Create the actions
|
||||||
FiniteTimeAction* actionMove = MoveTo::create( (float)actualDuration,
|
FiniteTimeAction* actionMove = MoveTo::create( actualDuration,
|
||||||
Point(0 - getOwner()->getContentSize().width/2, actualY) );
|
Point(0 - getOwner()->getContentSize().width/2, actualY) );
|
||||||
FiniteTimeAction* actionMoveDone = CallFuncN::create(getOwner()->getParent()->getComponent("SceneController"),
|
FiniteTimeAction* actionMoveDone = CallFuncN::create(
|
||||||
callfuncN_selector(SceneController::spriteMoveFinished));
|
CC_CALLBACK_1(SceneController::spriteMoveFinished, static_cast<SceneController*>( getOwner()->getParent()->getComponent("SceneController") )));
|
||||||
|
|
||||||
_owner->runAction( Sequence::create(actionMove, actionMoveDone, NULL) );
|
_owner->runAction( Sequence::create(actionMove, actionMoveDone, NULL) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,10 @@ ProjectileController* ProjectileController::create(void)
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void freeFunction( Node *ignore )
|
||||||
|
{
|
||||||
|
log("hello");
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectileController::move(float flocationX, float flocationY)
|
void ProjectileController::move(float flocationX, float flocationY)
|
||||||
{
|
{
|
||||||
|
@ -121,19 +125,25 @@ void ProjectileController::move(float flocationX, float flocationY)
|
||||||
float velocity = 480/1; // 480pixels/1sec
|
float velocity = 480/1; // 480pixels/1sec
|
||||||
float realMoveDuration = length/velocity;
|
float realMoveDuration = length/velocity;
|
||||||
|
|
||||||
// Move projectile to actual endpoint
|
auto callfunc = CallFuncN::create(
|
||||||
_owner->runAction( Sequence::create(
|
CC_CALLBACK_1(
|
||||||
MoveTo::create(realMoveDuration, realDest),
|
SceneController::spriteMoveFinished,
|
||||||
CallFuncN::create(getOwner()->getParent()->getComponent("SceneController"),
|
static_cast<SceneController*>( getOwner()->getParent()->getComponent("SceneController")
|
||||||
callfuncN_selector(SceneController::spriteMoveFinished)),
|
) ) );
|
||||||
NULL) );
|
|
||||||
|
|
||||||
|
// Move projectile to actual endpoint
|
||||||
|
_owner->runAction(
|
||||||
|
Sequence::create(
|
||||||
|
MoveTo::create(realMoveDuration, realDest),
|
||||||
|
callfunc,
|
||||||
|
NULL)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectileController::die()
|
void ProjectileController::die()
|
||||||
{
|
{
|
||||||
Component *com = _owner->getParent()->getComponent("SceneController");
|
Component *com = _owner->getParent()->getComponent("SceneController");
|
||||||
cocos2d::Array *_projectiles = ((SceneController*)com)->getProjectiles();
|
cocos2d::Array *_projectiles = static_cast<SceneController*>(com)->getProjectiles();
|
||||||
_projectiles->removeObject(_owner);
|
_projectiles->removeObject(_owner);
|
||||||
_owner->removeFromParentAndCleanup(true);
|
_owner->removeFromParentAndCleanup(true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue