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 7899689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:46:15+00:00 2026-06-03T08:46:15+00:00

So I’m at the point in my app where I need to replace the

  • 0

So I’m at the point in my app where I need to replace the image of a sprite and I think I know how to do it, but I’m having trouble implementing it. Basically, I’m making a domino game and I need to be able to flip the domino over so you can see the numbers.

Starting with my domino.h file….

#import <Foundation/Foundation.h>
#import "cocos2d.h"

@interface Domino : CCSprite {
    int int_leading;
    int int_trailing;
    int int_suitrank;
    int int_playerid;

    NSString *str_tilename;
    NSString *str_mirrortilename;    
}


@property  int int_leading,int_trailing, int_playerid, 

@property(nonatomic, retain) NSString *str_tilename;
@property(nonatomic, retain) NSString *str_mirrortilename;

-(void) print;
-(void) setTileName: (NSString *) theTileName;
-(void) setMirrorName: (NSString *) theMirrorName;
-(NSString *) str_tilename;
-(NSString *) str_mirrortilename;

@end

and then my .m file…

#import "Domino.h"

@implementation Domino

@synthesize int_leading,int_trailing, str_tilename, str_mirrortilename, int_playerid;

-(void) print     { 
    NSLog (@"%i/%i", int_leading, int_trailing);}

-(void) setTileName: (NSString *) theTileName;
{
    str_tilename=[[NSString alloc] initWithString: theTileName];
}

-(void) setMirrorName: (NSString *) theMirrorName;
{
    str_mirrortilename=[[NSString alloc] initWithString: theMirrorName];
}

-(NSString *) str_tilename
{
    return str_tilename;
}

-(NSString *) str_mirrortilename
{
    return str_mirrortilename;
}
@end

Finally, in my game layer…

Domino *d06 =[[Domino alloc] initWithSpriteFrameName:@"blank.png"];
TileName= @"0-6.png";
MirrorName= @"6-0.png";
[d06 setTileName: TileName];
[d06 setMirrorName: MirrorName];
d06.int_leading=0;
d06.int_trailing=6;

At this point, I add all the dominoes together into a large mutable array that tracks which ones are still available for players to pick. The problem I’m having is that I either haven’t found how to pull out the “TileName” from the mutable array, or maybe I have found it, but not understood it.

If I’m in a For loop, I would think the code should be something like

 NSString *temp1=[[[movableSprites objectAtIndex:i]valueForKey:@"str_tilename"]string];

But this just results in the program crashing. Can you point me in the right direction?

  • 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-06-03T08:46:17+00:00Added an answer on June 3, 2026 at 8:46 am
     NSString *temp1=[(Domino *)[movableSprites objectAtIndex:i] str_tilename];
    

    I think using this code will solve your stuff… Check for the syntax.. Hope this helps.. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I want to count how many characters a certain string has in PHP, but
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
In my XML file chapters tag has more chapter tag.i need to display chapters

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.