computer engineering (programming language: swift)
TRANSCRIPT
![Page 1: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/1.jpg)
Computer Engineering By Sethmi Kachchakaduge, Kevin Adams, Kimi
Hirano
![Page 2: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/2.jpg)
Overview● Intro● Project Description
o Building the platformo Example Codeo Flappy Fly Code
● Analysiso Challengeso What we learned
![Page 3: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/3.jpg)
Intro to Computer Engineering● Combines fields of electrical engineering and
computer science to develop computer hardware and software
● More focus on digital systems● Programming
![Page 4: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/4.jpg)
Project Description● Created “Flappy Fly”
o Version of Flappy Birdo Swift
● Programmed codeo Xcode
● SpriteBuildero Built in partso Location control
![Page 5: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/5.jpg)
Building the platform● Spritebuilder
o Backgroundo Groundo Obstacleso Heroo Nodeso Physics
![Page 6: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/6.jpg)
![Page 7: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/7.jpg)
Coding Basics● Basic Comparators (==, >, <, >=,
<=)● Basic Operators (=, +=, -=, *=, /=,
%=)● Variables● Logic
o if and elseo True and False
![Page 8: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/8.jpg)
Example• Var flappyFly = 6• flappyFly > 7 ‘false’• flappyFly < 7 ‘true’• If (flappyFly>4){• ‘flappyFly+=1’ • }• Else {• “flappyFly does nothing”• }
![Page 9: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/9.jpg)
Control Flow● For loops● For in loops● While loops● Do while loops
![Page 10: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/10.jpg)
Flappy Fly Code● Variable Ex
o var_gameOver = false
● Function Ex○ func spawnNewObstacle() {
var prevObstaclePos = _firstObstaclePosition if _obstacles.count > 0 { prevObstaclePos = _obstacles.last!.position.x }
● For loop Exo for ground in _grounds {
// get the world position of the ground let groundWorldPosition = _physicsNode.convertToWorldSpace(ground.position // get the screen position of the ground let groundScreenPosition = self.convertToNodeSpace(groundWorldPosition) // if the left corner is one complete width off the screen, move it to the right
![Page 11: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/11.jpg)
![Page 12: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/12.jpg)
Final Game
![Page 13: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/13.jpg)
Challenges● Inserting code in proper location
● Understanding the code
● Correctly following building process
![Page 14: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/14.jpg)
What we learned?● Different syntax● Order matters● Patience● Simplified code
![Page 15: Computer Engineering (Programming Language: Swift)](https://reader036.vdocuments.net/reader036/viewer/2022062316/589b5c801a28ab606f8b5bb7/html5/thumbnails/15.jpg)
Thank You