Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4119848
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:08:37+00:00 2026-05-20T23:08:37+00:00

I am a newbie at Cocos2D and i’m just getting started. I have set

  • 0

I am a newbie at Cocos2D and i’m just getting started. I have set up a scene, and I have to change the color of a line in Cocos2D. Please can anyone help me out with this? Any help will be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T23:08:37+00:00Added an answer on May 20, 2026 at 11:08 pm

    This should work:

    -(id) init{
    
    if((self = [super init])){
    
    //CGSize winSize = [[CCDirector sharedDirector] winSize];
    
    naughtytoucharray = [[NSMutableArray alloc] init];
    self.isTouchEnabled = YES;
    CCMenuItem *starMenuItem = [CCMenuItemImage itemFromNormalImage:@"ButtonStar.png" selectedImage:@"ButtonStarSel.png"
                 target:self selector:@selector(starButtonTapped:)];
    
    CCMenuItem *starMenuItem1 = [CCMenuItemImage itemFromNormalImage:@"ButtonPlus.png" selectedImage:@"ButtonPlusSel.png"
                 target:self selector:@selector(starButtonTapped1:)];
    
    CCMenuItem *menuItem1 = [CCMenuItemImage itemFromNormalImage:@"Button1.png" selectedImage:@"Button1Sel.png" target:self selector:@selector(button1Tapped:)];
    CCMenuItem *menuItem2 = [CCMenuItemImage itemFromNormalImage:@"Button2.png" selectedImage:@"Button2Sel.png" target:self selector:@selector(button2Tapped:)];
    CCMenuItem *menuItem3 = [CCMenuItemImage itemFromNormalImage:@"Button3.png" selectedImage:@"Button3Sel.png" target:self selector:@selector(button3Tapped:)];
    
     _scoreLabel = [CCLabelTTF labelWithString:@" MyScore" dimensions:CGSizeMake(150, 30) alignment:UITextAlignmentLeft fontName:@"Arial" fontSize:15];
    _scoreLabel.color = ccc3(255, 0, 0);
    [_scoreLabel setPosition:ccp(80, 300)];
    
    CCMenu *starMenu = [CCMenu menuWithItems:starMenuItem, nil];
    CCMenu *starMenu1 = [CCMenu menuWithItems:starMenuItem1, nil];
    CCRadioMenu *radioMenu = [CCRadioMenu menuWithItems:menuItem1, menuItem2, menuItem3, nil];
    
    
    
    starMenuItem.position = ccp(60, 60);
    starMenuItem1.position = ccp(60, 120);
    radioMenu.position = ccp(120, 120);
    
    [radioMenu alignItemsVertically];
    radioMenu.selectedItem_ = menuItem1;
    [menuItem1 selected];
    
    starMenu.position = CGPointZero;
    starMenu1.position = CGPointZero;
    [self addChild:starMenu];
    [self addChild:starMenu1];
    [self addChild:radioMenu];
    [self addChild:_scoreLabel];
    
    
    }
    [_scoreLabel setString:[NSString stringWithFormat:@"MyScore: %d", score]];
    
    return self;
    
    }
    
    -(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
    {
    
    UITouch *touch = [touches anyObject];
    CGPoint new_location = [touch locationInView:[touch view]];
    new_location = [[CCDirector sharedDirector] convertToGL:new_location];
    
    
    CGPoint oldTouchLocation = [touch previousLocationInView:touch.view];
    oldTouchLocation = [[CCDirector sharedDirector] convertToGL:oldTouchLocation];
    oldTouchLocation = [self convertToNodeSpace:oldTouchLocation];
    
    [naughtytoucharray addObject:NSStringFromCGPoint(new_location)];
    [naughtytoucharray addObject:NSStringFromCGPoint(oldTouchLocation)];
    
    
    
    }
    
    -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
    {
    if (buttonIndex == 0)
    {
    exit(0);
    NSLog(@"exit");
    }
    
    else if(buttonIndex == 1)
    {
    //CCScene *scene  = [CCScene node];
    [[CCDirector sharedDirector] replaceScene:[GameScene scene1]];
    NSLog(@"Play again");
    }
    }
    
    -(void)draw
    {
    glEnable(GL_LINE_SMOOTH);
    
    for (int i = 0; i < [naughtytoucharray count]; i+=2)
    {
    CGPoint start  = CGPointFromString([naughtytoucharray objectAtIndex:i]);
    CGPoint end  = CGPointFromString([naughtytoucharray objectAtIndex:i+1]);
    
    ccDrawLine(start, end);
    glColor4ub(200, 120, 120, 255);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Newbie with databases, I would like some advise please.. I have agencies who can
I am newbie to Cocos2d. I have this layer that represents my main game
Newbie question. I have a NSMutableArray that holds multiple objects (objects that stores Bezier
Newbie here...can I write one program which incorporates .NET LINQ and also various Java
Newbie question... The objective: I intend to have an HTML text input field as
Newbie question: I just installed VisualSVN Server and created a repository. I noticed that
Newbie question. I have Django models that look like this: class Video(models.Model): uploaded_by =
Newbie here, I have a struct for a word, which contains a char array
Newbie here. The following function works fine when $color refers to an entry in
Newbie backbone question: Context: Building a shopping list with backbone I have a model

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.