Tag Archives: 2D

Sprite Kit Swift 2 Tutorial for Beginners

Sprite Kit Swift 2 Tutorial for Beginners
// Ray Wenderlich

Learn how to create a simple 2D iOS game in this Sprite Kit Swift 2 Tutorial!

Note from Ray: This is a Swift 2 and iOS 9 update to a popular tutorial on our site, released as part of the iOS 9 Feast.

Like Batman and Robin or Superman and Lois Lane, Sprite Kit and Swift are an amazing combination:

  • Sprite Kit is one of the best ways to make games on iOS. It’s easy to learn, powerful, and is fully-supported by Apple.
  • Swift is an easy language to get started with, especially if you are a beginner to the iOS platform.

In this tutorial, you will learn how to create a simple 2D game using Apple’s 2D game framework, Sprite Kit – using Swift!

You can either follow along with this tutorial, or just jump straight to the sample project at the end. And yes. There will be ninjas.

Note: This tutorial has a special place in my heart, as the original version was one of the first tutorials ever released on our site. It was written in a completely different language (Objective-C) and a completely different game framework (Cocos2D). My, how times have changed! :]

2D iOS & tvOS Games by Tutorials Now Available!

2D iOS & tvOS Games by Tutorials Now Available!
// Ray Wenderlich

Note from Ray: Happy Wednesday – it’s book release day during the iOS 9 Feast!

Today we are happy to release our brand new book 2D iOS & tvOS Games by Tutorials.

In this book, you will learn how to make iOS and tvOS games in Swift using Apple’s built-in 2D game framework: Sprite Kit. Through a series of mini-games and challenges, you will go from beginner to advanced and learn everything you need to make your own game.

Keep reading to learn more about the history of the book, what’s inside, and how you can get your copy!

History of This Book

2D iOS and tvOS Games by Tutorials Now Available!

Introduction to StageJS

via Introduction to Stage.js.

Stage.js is a lightweight and open-source JavaScript library that you can use for cross-platform 2D HTML5 game development. This library uses a DOM-like model to manipulate the canvas and manages the rendering cycles of your application all by itself.
In this tutorial, I’ll introduce you to this library, trying to cover everything you may need to know how to start using it with ease.
Let’s start!

nmap.JS: Javascript implementation of nmap

via sebastian-meier/nmap.js · GitHub.

This is a javascript implementation of nmap a neighborhood preserving space-filling algorithm for a set of 2D-points. The original nmap algorithm was written by Duante et al.[1] in Java. The code written by the team from São Paulo is brilliantly straight forward, so it was quite easy to implement. The training datasets used in the examples were also generated by them.

This implementation also makes use of a slightly modified version of the AffineTransform function by Google, originally part of the closure repository. I modified it slightly so that we can include just the function without the rest of the closure library.

Important Notice: This is not a D3 plugin or widget, this is a standalone set of functions that allows you to generate a treemap from a list of 2D points. But as shown in the examples you can then use the returned list of objects to draw the treemap with D3, as shown in the examples.

Creating PIXI.js filters using WebGL

via Creating PIXI.js filters using WebGL | Tizen Developers.

PIXI.js 3.0 is a great library for creating 2D canvas games and animations. It’s one of the most used canvas renderers over the Web. It also supports WebGL rendering, thanks to which most of the operations are executed by GPU instead of CPU. It comes with a nice filters feature that has great possibilites and is quite easy to use and extend. In this article we will focus on describing how to create a custom filter using Fragment shaders.

An Introduction to Quartz 2D

via An Introduction to Quartz 2D – Tuts+ Code Tutorial.

Quartz 2D is Apple’s 2D drawing engine, an important component of the Core Graphics framework. You may often see Quartz 2D referred to as Core Graphics or simply CG.

Quartz 2D uses the “painter’s model”. In the painter’s model, each successive drawing operation applies a layer of “paint” to an output “canvas”, often called a page. Think of this as an artist working on a painting. If the artist were to paint the entire canvas blue and then paint some clouds onto the canvas then the clouds would cover the blue beneath them. Once something is “painted” onto the canvas, it cannot be changed but by adding more paint atop of it.

All drawing in Quartz 2D is done through a graphics context of type CGContextRef. With a reference to a graphics context, you can use the Quartz 2D functions to draw to the context, perform operations, such as translating the context, and change graphic state parameters, such as line width and fill color. Quartz 2D is a C-based API, as such you will invoke the C functions passing in the context as a parameter.

To draw to the screen on iOS, you must subclass a UIView and override itsdrawRect(_:)method. It is inside this drawRect(_:) method that you will do any custom drawing. You should never call the drawRect(_:) method directly in your code. If you need to update the screen with fresh drawing commands, you should call the methods setNeedsDisplay() or setNeedsDisplayInRect(_:).

When using Quartz 2D on iOS, the coordinate (0,0) is at the top left of the screen. The x coordinate increases as you move right and the y coordinate increases as you move down.

Throughout this tutorial, you may wish to consult the Quartz 2D programming guide. The purpose of this tutorial is to get started using Quartz 2D. There is much that will not be covered and to fully appreciate all that Quartz 2D has to offer I suggest you read the programming guide.

With this brief introduction out of the way, let’s get started using Quartz 2D.

Udemy – Python GUI and Gaming 101

This course is a one-stop-shop for all things GUI! We’ll be using the Tkinter Module of Python for all our graphics and animations. We’ll start with the basics, buttons, labels, etc. Once we cover those, we’ll move on to more complex things, like performing actions from button clicks, getting entry data, and then we’ll create a full-fledged Calculator!