- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
//播放器.m
#import "Player.h"
@implementation Player
+(id)player{
Player *player = [Player spriteNodeWithColor:[UIColor brownColor] size:CGSizeMake(32, 32)];
player.name = @"player";
player.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:player.size];
return player;
}
- (void)walkRight {
SKAction *incRight = [SKAction moveByX:10 y:0 duration:0];
[self runAction:incRight];
}
@end
//MyScene.h
#import "MyScene.h"
#import "Player.h"
@implementation MyScene
-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
/* Setup your scene here */
self.anchorPoint = CGPointMake(0.5, 0.5);
self.backgroundColor = [SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];
SKSpriteNode *ground = [SKSpriteNode spriteNodeWithColor:[UIColor greenColor] size:CGSizeMake(self.frame.size.width, 30)];
ground.position = CGPointMake(0, -self.frame.size.height/2 + ground.frame.size.height/2);
ground.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:ground.size];
ground.physicsBody.dynamic = NO;
[self addChild:ground];
Player *player = [Player player];
[self addChild:player];
}
return self;
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
Player *player = (Player *)[self childNodeWithName:@"player"];
[player walkRight];
}
-(void)update:(CFTimeInterval)currentTime {
/* Called before each frame is rendered */
}
@end
我是 objective-c 的新手。好吧,我尝试构建上面的代码并得到错误“'Player'的不可见@interface声明选择器'walkRight'”我真的不知道为什么。如果有人能帮助我,我将不胜感激。谢谢。
最佳答案
确保您已在 Player.h 文件中声明了 walkRight 方法。这应该在该文件中的接口(interface)声明之后的某个地方:
-(void)walkRight;
这允许导入 Player.h 的其他文件知道 Player.m 实现了 walkRight 方法。
关于ios - 'Player' 没有可见的@interface 声明选择器 'walkRight',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24377901/
class Skeleton { public: void attack(Player player) { if (canAttackSkeleton()) {
我是使用 Java 播放音频的新手。我编写了代码来播放一些广播流。 我发现有一些流媒体网址,例如 http://fm939.wnyc.org/wnycfm .这没有端口号并包含斜杠。我只能使用 jav
我在我的 ReactPlayer 组件中使用 light={true} 设置在视频列表中显示缩略图。这在初始加载时工作正常。但是,当用户单击缩略图时,我会打开一个模式来播放视频(在单独的 ReactP
所以我目前正在为玩家重构游戏中的代码并启动一个玩家类: import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input; import com.b
某些应用程序和 IDE 建议安装 Adobe Flash 播放器的调试版本。我知道即使没有通过测试电影运行 Flash,这也允许查看跟踪语句,但还有什么不同呢?有什么事吗? 此外,我如何判断我看到
我已经阅读过类似的问题,但没有一个对我的情况有帮助。 这是我的 YouTube iframe: 我动态添加了 src 属性。 这是我的播放器: var player; function onYou
研究了许多主题和不同的领域后,我感到不知所措。我知道答案可能很简单,但我只是没有看到它。言归正传,这就是我正在做的事情。 我有一个本地托管的网页,当前如果在 Internet Explorer 中加载
Jwplayer 在正确加载视频之前闪烁“加载播放器时出错:无法加载播放器配置”一秒钟。我只是觉得这看起来不专业,我花了很多时间寻找如何抑制错误或隐藏它,直到视频加载完成。 在 Chrome 或 Sa
在 Exoplayer 版本中 2.14.1 Playerd.EventListener()已弃用。当我阅读文档时,它说使用而不是 Player.Listener ,但我不知道如何使用该方法,如下面的
我正在尝试创建一个按钮,允许用户单击它并停止嵌入的 YouTube 视频。但是,每当我尝试调用播放器对象本身来使用函数player.playVideo()时,我都会收到一条错误消息,指出该函数未定义。
我正在通过制作一个简单的纸牌游戏来学习数据结构。在这段代码中,我有一个类 Player 和一个包含游戏中所有玩家的 Queue。 队列的实现: template class Queue{
MPMoviePlayerController 播放器在按下完成按钮后永久隐藏播放器控件。 我有一个带有 moviePlayer.controlStyle = MPMovieControlStyleE
Player::Player(string Playername, int nr ,Board* x) { imie= Playername; number=nr; int k
情况是这样的。我在我的 Django REST API 上得到了一个列表:/playerslist/ 它返回了一个玩家列表,就像这个一样: http://pastebin.com/JYA39gHT 这
我有一个 YoutubePlayer 在我的 Motion Layout 中播放视频。我想实现这个youtube-like motion https://developer.android.com/t
我一直在使用 MPC-HC 窗口的状态文本来确定视频是正在播放还是暂停。但是,在全屏模式下或隐藏状态栏时,状态文本不会更新。有人向 MPC-HC 团队指出了这个错误,但尚未解决:https://tra
我的 Blackjack 默认构造函数中有这一行。 m_players[0].SetPlayerName("Jane"); 这在我的 Player 类中使用了一个 setter 来将玩家的名字设置为
我最近一直在开发 Ruby on Rails 应用程序。我们使用 Yahoo Web Player 来播放我们的音频和视频文件。它工作得非常好,特别是对于不允许使用 Flash 的平板电脑和智能手机。
更新:这个问题的前提被证明是被误导的。除非移动是响应用户单击,否则不会发生此问题。请参阅here . 这几天我一直在为一个错误而苦苦挣扎,希望有人能提供帮助。 我有一个 jquery 脚本,它使用 j
用图片说明更容易。抱歉审查。 在这个屏幕中有一个 WebView 是白色的部分,包含一个带有 Flash 内容的网页。 Flash 内容应该在底部红色条下方(部分隐藏在后面),因为 webview 边
我是一名优秀的程序员,十分优秀!