Become familiar to Xcode and SpriteKit

My third post. Damn!

Well... Hi blog.

So I thought it would be fun to make a tutorial on how to make your very own game step by step. Here we go!

I will take it in baby steps! In this post i will be telling you how to make your very first Xcode project and


Step one: Create a new Xcode project


The first time you are opening Xcode you will get this menu. The playground is a place where animals roam freely and flowers grow... Nah just kidding. It's a place where you can experiment like a mad scientist or doctor, but the chemicals is replaced with code. But let's get started with a new Xcode project.

After clicking on the Create a new Xcode button you will face another menu! Why?! Well, here you can choose what kind of template you want your game or app would be in. I'm choosing Game since that is what I know best.



Here you just type in your project name, team, orgization name and organization identifier. If not default, set the language to swift and Game Technologi to SpriteKit. I don't know what the other stuff does so don't blame me if something goes wrong, but feel free to experiment.

Step two: Making an app for the first time!



When you have done all of the boring stuff you are finally here:

For simplicity's sake do not mess around here if you are are new to this...

Only uncheck Lanscape Left and Landscape Right since we are not focusing on landscape oriented games.

Now let's begin with the fun part:


Now, look at the colors! 



In GameViewController.swift delete all the colored text (blue, white and purple) and write this:
Now you can go to GameScene.swift and delete everything there as well and instead type this:
Then press the play button in the top left corner.
An iPhone simulator should appear on the screen. And voila! A blue square should be shown in the middle of the screen like this!
What happens here is that I made variable called box which is an SKSpriteNode(). SKSpriteNode is kinda like a picture that is used for games. This variable can I use in all functions (func). I made a new func called startGame() where declare the the box color, size, position and added that to the the table, almost like cooking! Then I call the function startGame() from didMove(to view: SKView) since this is what the iPhone first is calling when opening an app. First it calls on didMove(to view: SKView) and than it calls startGame().

Now you know how to make a square and make it appear on your iPhone. Next I will be showing you how to make it move when tapped.

See ya next time! :)

✌out and enjoy!

Kommentarer

Populære innlegg fra denne bloggen

let's start cookin' (making a game for iPhone)

It's time to get Schwifty in here! (Timers)

programming tips with meeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee! :D