In addition to modifying sprites through code, you can also create them in code. This tutorial shows how to create a sprite in code and add it as a child of another node.
- [Lecturer] So we've looked at modifying…an existing sprite using code but what about creating…a sprite from scratch using code.…The first thing I'm going to do is import a sprite.…Now of course, you don't have to do this.…You can just use this built-in spaceship if you want…and it will work just fine.…I just also want to show how you can bring sprites…into your games.…So I'm going to tab over to Finder…with my Assets folder selected…and then I'm going to go inside the Assets folder,…in the Exercise files and just click and drag player_frame1…right in here into my Assets.…
So I have this spaceship right here…and now we can create one using code.…So I'll go to GameScene.swift,…inside of here, I'm going to define a constant.…I'll call this Player…and this is going to be an SKSpriteNode.…And this time, I'm going to set it equal to…the SKSpriteNode Costructor.…The one that we want is ImageNamed…and this is going to grab the image from our Assets.…Type that out and a string should be…the string of the image…which again, is Player_frame1.…
- Creating a SpriteKit project
- Adding and modifying sprites
- Creating sprites in code
- Transitioning between scenes
- Working with children and parents
- Adding physics
- Detecting and responding to collisions
- Applying particle effects
- Creating actions
- Working with sound
- Adding cameras and lights
Skill Level Intermediate
Careers in the Game Industrywith Christian Bradley1h 19m Beginner
Building a Game App with the Android SDKwith David Gassner2h 6m Intermediate
1. Introduction to SpriteKit
2. Add Physics
3. Work with Particle Effects
4. Work with Actions
5. Work with Audio
6. Additional Features
Next steps1m 41s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.