Let say we want to capture the screen of your game and have it as a video in output.
Search results on “How to record screen video in swift” will lead us to RPScreenRecorder, it’s kind of cool, but for security reasons you are no allowed to save video or even access it. The only trick how to solve it is to make number of screenshots, save them as an array of Images. Unfortunately, you can deal with some performance issues here, it could be feasible to make like 30 fps capturing but it depends on many factors. For my game I came up with 30/5 fps, here’s the whole code:
Continue reading “Swift: how to record a screen video, or convert images to videos”
To perfect the collision detection, basically to ignore transparency during the interest we can use SKPhysicsBody. The idea here is to have two images – one is what User sees, another is very simplified version for SpriteKit engine – simplified from color and geometry standpoint. The more complex “collision body” is the more resources it will spend during each frame to calculate collisions. Just for instance here’s the actual image and it’s “mask”
Now we are ready for some code
Continue reading “How to add pixel-perfect physics to an SKSpriteNode”
You might had a chance to check out the new trend – scream application. The most popular one I believe “Chicken Scream”. The new weird and funny interface for the games. Let’s take a look at how chicken scream works – the main part of functionality is to detect the background noice to set up the threshold, and to get “loudness” value – some how to measure the decibels.
In scope of my tests and investigations I’ve decided to create a flappy bird like game but where you need to scream, kind of flappy bird scream, you may want check out the result – “Scream to Fly” (appstore link, my site link)
All right, the first thing to start you need to request access to the mic, to have such ability we need to add the following to the Info.plist – click “plus” and start typing “Privacy – Microphone Usage Description” and add the value, something like – “Access to microphone is needed to detect noice level only.”. This message will appear when you request the access to it programmatically.
To check whether permissions were granted or to request ones you’ll need the following method:
Continue reading “Swift: how to get decibels”
Just a quick example how to use WKInterfaceActivityRing and HKActivitySummary to show Activity Ring.
Go ahead and drag “Activity Ring” on your Interface Controller, use Assistant Editor to add Outlet to your Controller, e.g.
@IBOutlet var activityRing: WKInterfaceActivityRing!
All you need to set up Activity Ring values is to create and initialize HKActivitySummary, here is the sample code (for simplicity we are going to use the same values for all the rings)
let summary = HKActivitySummary()
let value: Double = 2
let goal: Double = 10
summary.activeEnergyBurned = HKQuantity(unit: HKUnit.kilocalorieUnit(), doubleValue: value)
summary.activeEnergyBurnedGoal = HKQuantity(unit: HKUnit.kilocalorieUnit(), doubleValue: goal)
summary.appleExerciseTime = HKQuantity(unit: HKUnit.minuteUnit(), doubleValue: value)
summary.appleExerciseTimeGoal = HKQuantity(unit: HKUnit.minuteUnit(), doubleValue: goal)
summary.appleStandHours = HKQuantity(unit: HKUnit.countUnit(), doubleValue: value)
summary.appleStandHoursGoal = HKQuantity(unit: HKUnit.countUnit(), doubleValue: goal)
activityRing.setActivitySummary(summary, animated: true)
That’s pretty much it.
http://www.youtube.com/watch?v=r7xnKSPWTjo – it is really cool presentation for anyone who cares about the web (by Christian Heilmann http://christianheilmann.com/)
P.S. just put here some interesting tools:
I have heard about hackathon events in Facebook and Google and about all this hackers culture, that could pass for something for nerds only. I have even experience as an organiser of company’s internal hackathon event. And finally I took part in hackathon
in person with excellent team, and this is beyond words how cool it was. It is the great challenge to create something new, something completely ready for demo, only for 24 hours.
In hackathon you can participate in all phases of the software’s lifecycle only for 24 hours.
Some tips that I discovered for myself:
find your team
find something like whiteboard and marker
come up with some ideas
finally choose idea that your team will implement
work out the details of minimum working version – all features and improvements MUST be hold over till minimum version will be ready
DON’T try to do everything right, I’m about good architecture design and universalism. This is very important point that may save your time. If you can not do something fast enough – hack it. If you have a problem – hack it. This is HACKathon. The result you will show on the demo, so you should hack enough to prepare application for the demo
Think about what will take place at the demo
It’s obviously, but divide functionality into tasks.
It is necessary to monitor progress of each team member. For example we have been working by agile methodology. We used 45 minutes sprints. And after each sprint we got stand up meeting. Then we must rest – 10-20 minutes we had been playing in kicker/kinect/eat something/etc
rest is very important point – don’t forget about it
Here is our result – https://github.com/DjComandos/MobileRockBand
Looking forward to the next Hackathon.
Here is the collection of some helpful videos for front-end developers (by Paul Irish) http://delicious.com/paul.irish/frontend+video
Just another first post. Seems that it’s finally the latest new blog (2013-…) =)
Previous blogs could be found here (RU):
and another one