我对iOS,Objective C和使用Xcode都很陌生.我只做了一个简单的新闻类型的应用程序,但现在我想创建一个我在另一个平台上发布的游戏.
基本上,我有一个对象随机出现然后淡出,目的是点击对象使其消失.
然而,即使我设置,我似乎无法点击该对象 mySKSpriteNode.userInteractionEnabled = YES;
这是我的touchesBegan方法中的内容:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
/* Called when a touch begins */
NSLog(@"Something was touched");
UITouch *touch = [touches anyObject];
NSLog(@"%@", touch);
CGPoint location = [touch locationInNode:self];
SKNode *node = [self nodeAtPoint:location];
if(node == mySKSpriteNode)
[node runAction:[SKAction fadeOutWithDuration:0]];
}
Run Code Online (Sandbox Code Playgroud)
在我的日志中,当我点击屏幕时(不是我有对象的地方),我得到了这个:
2014-02-17 23:18:30.870 BubbleChallenge[48541:70b] Something was touched
2014-02-17 23:18:30.875 BubbleChallenge[48541:70b] <UITouch: 0x1130ea530> phase: Began tap count: 1 window: <UIWindow: 0x109c2ab60; frame = (0 0; 320 568); autoresize = W+H; gestureRecognizers = …Run Code Online (Sandbox Code Playgroud) 我正在开发一款游戏,我需要实现顶级栏,持有得分和其他东西等细节.
我的顶栏应该有以下(从左到右): - 一个50x50的图标,根据级别改变,但它的大小相同 - 一个标签,其中一些文字根据级别而变化 - ...其他元素
问题是当标签文本发生变化时,标签有时离图标太远,而其他时间则超过图标(取决于文本长度)
我以为我理解定位,但显然我没有...
//create array for level text label
levelTextArray = [[NSArray alloc] initWithObjects:@"\"Uuu! Bubbles!\"",@"\"Noob\"",@"\"I’m getting it..\"",@"\"This is easy\"",@"\"Wha?\"",@"\"It’s ooon now!\"",@"\"Come on..\"",@"\"Dude…\"",@"\"You’re pushing it..\"",@"\"I’ll show you!!\"",@"\"AAAAAAA!!!\"",@"\"Holy Bubbles… \"",@"\"Ninja mode on!\"",@"\"I’m on fire!!\"",@"\"The wheel's spinning, but the hamsters dead. \"", nil];
//add level text label
levelTextLabel = [[SKLabelNode alloc] init];
levelTextLabel.text = levelTextArray[0];
levelTextLabel.position = CGPointMake(60, CGRectGetMidY(scoreImage.frame)+5);
levelTextLabel.fontColor = [UIColor colorWithRed:0/255.0f green:1/255.0f blue:0/255.0f alpha:1.0f];
levelTextLabel.fontName = @"Noteworthy-Light";
levelTextLabel.fontSize = 14.0;
[self addChild:levelTextLabel];
Run Code Online (Sandbox Code Playgroud)
scoreImage是这种情况下的图标.另外..为了使图像完全出现在视图中,我将它定位如下:
scoreImage …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取这些类别中帖子的所有帖子 ID(关系 OR):10,11,12,13,14 以及某些额外属性。然而我的问题是类别。
我的 wp_query 的 args 数组如下:
$args = array(
'orderby' =>'ID',
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => -1,
'category__in' => array('10','11','12','13','14'),
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'joke_type',
'value' => $type,
'type' => 'CHAR',
'compare' => '='
),
array(
'key' => 'joke_rating',
'value' => 3,
'type' => 'SIGNED',
'compare' => '>='
)
),
'fields' => 'ids'
);
Run Code Online (Sandbox Code Playgroud)
这只会获取类别 10 中的帖子(或我在数组中放在第一位的 ID)。我也尝试过:'category__in' => '10,11,12,13,14'和'category' => '10,11,12,13,14'都'cat' => '10,11,12,13,14' …
objective-c ×2
sknode ×2
sprite-kit ×2
categories ×1
ios ×1
sklabelnode ×1
skspritenode ×1
wordpress ×1