第三周作业

第三周作业

作业的来源:

1.书上的课后作业

2.课件上面的随堂讨论或作业

3.你瞎想到的问题

4.【推荐】在实际项目中,结合软件工程知识点,提出作业

来自:烦人的老宋


在实际项目中,结合软件工程知识点,提出作业

image


结合个人项目进行的一些问题的发现

  1. 功能测试
    • 功能测试:验证模版的功能
    • 集成测试:验证几个互相有依赖关系的模版的功能
    • 场景测试:验证几个模版能否完成一个用户场景
  2. 非功能测试
    • 兼容性测试:测试软件在不同配置下能否正常工作
    • 易用性测试:测试软件是否好用

问题的解答

功能测试

func makebg() {
    
    let bgTexture = SKTexture(imageNamed: "bg.png")
    
    let movebg = SKAction.moveByX(-bgTexture.size().width, y: 0, duration: 9)
    let replacebg = SKAction.moveByX(bgTexture.size().width, y: 0, duration: 0)
    let movebgForever = SKAction.repeatActionForever(SKAction.sequence([movebg, replacebg]))
    
    
    for var i: CGFloat = 0; i<3; i++ {
        
        bg = SKSpriteNode(texture: bgTexture)
        
        bg.position = CGPoint(x: bgTexture.size().width/2 + bgTexture.size().width * i, y: CGRectGetMidY(self.frame))
        
        bg.size.height = self.frame.height
        
        bg.zPosition = -5
        
        bg.runAction(movebgForever)
        
        movingObjects.addChild(bg)
        
    }
    
} 

此模版为将背景插入到该游戏中去,测试正常插入,尺寸和位置均设置妥当

override func didMoveToView(view: SKView) {
    /* Setup your scene here */
    
    self.physicsWorld.contactDelegate = self
    
    self.addChild(movingObjects)
    
    self.addChild(labelContainer)
    
    makebg()
    
    scoreLabel.fontName = "Helvetica"
    scoreLabel.fontSize = 60
    scoreLabel.text = "0"
    scoreLabel.position = CGPointMake(CGRectGetMidX(self.frame), self.frame.size.height - 70)
    self.addChild(scoreLabel)
    
    let birdTexture1 = SKTexture(imageNamed: "flappy1.png")
    let birdTexture2 = SKTexture(imageNamed: "flappy2.png")
    
    let animation = SKAction.animateWithTextures([birdTexture1, birdTexture2], timePerFrame: 0.1)
    let makeBirdFlap = SKAction.repeatActionForever(animation)
    
    bird = SKSpriteNode(texture: birdTexture1)
    
    bird.position = CGPoint(x: CGRectGetMidX(self.frame), y: CGRectGetMidY(self.frame))
    
    bird.runAction(makeBirdFlap)

    bird.physicsBody = SKPhysicsBody(circleOfRadius: birdTexture1.size().height/2)
    
    bird.physicsBody!.dynamic = true
    
    bird.physicsBody?.allowsRotation = false
    
    bird.physicsBody!.categoryBitMask = ColliderType.Bird.rawValue
    bird.physicsBody!.contactTestBitMask = ColliderType.Object.rawValue
    bird.physicsBody!.collisionBitMask = ColliderType.Object.rawValue
    
    bird.physicsBody!.allowsRotation = false
    
    self.addChild(bird)

    let ground = SKNode()

    ground.position = CGPointMake(0, 0)
//        ground.zPosition = 5
    ground.physicsBody = SKPhysicsBody(rectangleOfSize: CGSizeMake(self.frame.size.width, 1))
    ground.physicsBody!.dynamic = false
    
    ground.physicsBody!.categoryBitMask = ColliderType.Object.rawValue
    ground.physicsBody!.contactTestBitMask = ColliderType.Object.rawValue
    ground.physicsBody!.collisionBitMask = ColliderType.Object.rawValue
    
    self.addChild(ground)
    
    let sky = SKSpriteNode()
    
    sky.position = CGPointMake(780, 780)
//        sky.zPosition = 5
    sky.physicsBody = SKPhysicsBody(rectangleOfSize: CGSizeMake(self.frame.size.width, 1))
    sky.physicsBody!.dynamic = false
    
    sky.physicsBody!.categoryBitMask = ColliderType.Object.rawValue
    sky.physicsBody!.contactTestBitMask = ColliderType.Object.rawValue
    sky.physicsBody!.collisionBitMask = ColliderType.Object.rawValue
    
    self.addChild(sky)
    
    
    _ = NSTimer.scheduledTimerWithTimeInterval(3, target: self, selector: Selector("makePipes"), userInfo: nil, repeats: true)
    
}

这个func 是主界面的实现,与背景模版makebg()和管道模版makepipes()调用正常

场景测试:

image
主场景正常

非功能测试

兼容性测试

测试机型 是否运行 是否正常游戏
iPhone 5s
iPhone 6
iPhone 6s

易用性测试

作者询问几个同学,可耻的得到了该游戏易上手的结论。233


更多代码细节,请访问我的coding 的主页
2013551824/FlappyBird_ios


如有使用,请告知作者。

posted on 2016-03-19 11:00  薛长城2013551824  阅读(113)  评论(0编辑  收藏  举报

导航