Forum > C# > this.unschedule(bullets);

this.unschedule(bullets);

By theshivu Posted 2012-03-02 05:12 Comments 5
theshivu
  • Posts: 21
  • Location: Banglore

this.schedule(bullets,0.3f);

public void bullets(float interval)
{
throwprojectile(new CCPoint(820, 240));
}

public override void ccTouchesEnded(List<CCTouch> touches, CCEvent event_)
{
if(touches.Count>0)
{
this.unschedule(bullets); // ?
CCTouch loc = touches.ElementAt;
touches.Clear;
CCPoint location = loc.locationInView);
location = CCDirector.sharedDirector.convertToGL;
// Determine offset of location to projectile
float offX =location.x - 20;
float offY = location.y ~~240;
// Bail out if we are shooting down or backwards
if return;
//ok to add projectile here now
// Determine where we wish to shoot the projectile to
float realX = size.width 10;
float ratio = offY / offX;
float realY =
240;
CCPoint realDest = new CCPoint;
throwprojectile;
// Determine the length of how far we’re shooting
// Move projectile to actual endpoint
/* ,
,nil]];*/
touches.Clear;
}
base.ccTouchesEnded;
}

public void throwprojectile
{
float realMoveDuration;
CCSprite projectile = CCSprite.spriteWithFile);
projectile.position = new CCPoint;
this.addChild;
float offRealX = 820~~ projectile.position.x;
float offRealY = 240 - projectile.position.y;
float length = Math.Sqrt + );
float velocity = 480 / 1; // 480pixels/1sec
realMoveDuration = length / velocity;
projectile.runAction, CCCallFuncN.actionWithTarget));
this.resumeSchedulerAndActions; //???? what to put here
}

I am tryng to throw bullets at sheduler and whenever user clicks on screen i did changed the target destination once again i want to shoot at default when user doesnt clicks?

theshivu
  • Posts: 21
  • Location: Banglore

#1 RE: 2012-03-02 05:30

Right now i used some flags, and its working,, but how to pause and resume shedule????

jwa@javatopia.com
  • Posts: 243
  • Location: Totally Evil Entertainment - San Diego

#2 RE: 2012-08-10 15:56

I know this is a very old post, but did you see:

CCScheduler.sharedScheduler().pauseTarget(this);

This will allow you to pause and resume the scheduler on your target.

Logan
  • Posts: 88

#3 RE: 2012-08-12 04:56

He’s not working on this anymore.. but thanks for the reply.

jwa@javatopia.com
  • Posts: 243
  • Location: Totally Evil Entertainment - San Diego

#4 RE: 2012-08-13 04:00

hi Raghu,

I noticed someone posted a question about Box2d and cocos2d-xna. Are you using The Bullet XNA API or some other xna-bullet-type API? i am wondering if I need to port box2d or just add support for bullet and other bullet-type APIs?

— jake

Logan
  • Posts: 88

#5 RE: 2012-08-13 05:30

Hi Jake,

No I have not used Bullet XNA yet. It would be very cool to have this. It is better to ask other Dev’s about their interest to have this in cocos-xna.

regards,
Raghu

Loggin to reply

Copyright © 2010 - 2013 Cocos2d-x.orgClustrmaps