Apple's GameplayKit framework provides pathfinding, goal-based movement, rulesystems, entity-component systems, finite state machines and random distribution classes for game developers. Also included is a class and related protocols for building turn-based AIs based on minmax tree search. Available for iOS 9 and OS X 10.11.
Questions tagged [gameplay-kit]
190 questions
0
votes
1 answer
GameplayKit find path to moving sprite
I want a sprite to follow the player and I tried to achieve this with the Pathfinding of GameplayKit. This is working, but there's problem. I get the path from the enemy sprite to the player sprite with the following code:
func moveEnemy(to…

Marcel
- 472
- 2
- 6
- 19
0
votes
1 answer
I constantly get the error 'Instance member isPaused cannot be used on type GameScene'
This is the code I have and I have a button that when I click it, I want to pause the game to show a menu... I have comments where the error is showing up, so you can hopefully see what I'm doing wrong.
Also I'm not sure if this code is supposed to…

husky
- 11
- 1
- 5
0
votes
1 answer
Using GKComponent to make reusable shields
I am trying to make a simple game: Space ship on the bottom of the screen shooting asteroids "falling" from the top of the screen.
I am learning ECS and GameplayKit, and have been trying to turn shields into a component. I've heavily relied on…

jjatie
- 5,152
- 5
- 34
- 56
0
votes
1 answer
Can I make self.entity a non optional for certian functions in a GKComponent using swift?
I'm using the GameplayKit entity component system to develop a game.
I have a number of GKComponent. Most of the instance functions require that self.entity is not nil, but it is an optional, as a component may be initialised before being attached…

Relequestual
- 11,631
- 6
- 47
- 83
0
votes
2 answers
What is GKS file in GameplayKit?
I'm learning sample code SceneKit team demonstrated in SceneKit: What's New.
I find a file has extension .gks and it seems is resource of GameplayKit.
Here is it loading:
#if EnableGamePlayKit
_gkScene = [GKScene…

ooOlly
- 1,997
- 21
- 31
0
votes
1 answer
Handling Key Presses In GKStates
Note: This is for SpriteKit using Objective C.
I have a single scene called GameScene in my game and I'm using a GKStateMachine to handle the various states Play, Pause and ReadyToPlay. I know you can handle all of the key presses in the keyDown:…

02fentym
- 1,762
- 2
- 16
- 29
0
votes
2 answers
Spritekit Gameplaykit : Component inspector in Xcode level editor?
In Xcode 8, sprite kit level editor, there is a component inspector at the right panel. what is for ?
Also, when you create just a new spritekit project, you got this line of code, at line 26 in GameViewController.swift :
// Copy gameplay related…

hungry
- 174
- 8
0
votes
2 answers
Swift: conforming to properties in protocol?
How to confirm to protocols that declares properties of other protocols in Swift?
There is a protocol GKGameModel in which its implementers need to have a properties conforming to a protocol
public protocol GKGameModel {
// ...
public var…

adib
- 8,285
- 6
- 52
- 91
0
votes
0 answers
Problems with ApplyImpulse in SpriteKit
I'm new to SpriteKit, and I don't know why my code is not working at all. After I create all the nodes, the only one that I want affected by physics is the ball. I want to apply an impulse to the ball node, but I can' make it work.
Here's the…

Gonzalo Duarte
- 45
- 1
- 6
0
votes
3 answers
Xcode error: Semantic Issue, Property 'className' not found on object type 'GKEntity *'
Recently I started getting this error from Xcode:
Error Screenshot
This 'className' property belongs to NSObject. Here is the official documentation.
Why is this happening and how do I solve this (without avoiding using this property)?
The strange…

ZanYzer
- 45
- 10
0
votes
1 answer
How to implement GKState's isValidNextState in Objective C
It seems that all of the examples for GameplayKit are always in Swift. I've decided not to move over to swift for now and I've just been translating a lot of code into Objective C, which is fine most of the time.
I'm trying to implement the…

02fentym
- 1,762
- 2
- 16
- 29
0
votes
1 answer
GKComponentSystem in Xcode 8 Swift 3
I'm having trouble converting my project to Swift 3. In previous version of Swift I can declare a class under GKComponentSystem like:
class EnemyMoveComponentSystem: GKComponentSystem {
}
However in swift 3 it forces me to add < GKComponent > in…

Bob
- 155
- 1
- 8
0
votes
1 answer
Swift 3: class doesn't function correctly
So I've got a class named FlashyPaddleEffect. I also mention it in another class, GameScene, but it doesn't apply any effect that it should. The paddle should be flashing blue and white colors, but it simply stays white. The paddle also should lose…

Andrew
- 1
- 1
0
votes
1 answer
How to change keyboard repeat rate in a game?
I am writing a game for Mac OS in Swift 3 with SpriteKit and GameplayKit.
I already have created a method to capture keyboard press events and can control my character on the map. Sprite is moving using MovementComponent which is applying movement…

Alex Kreston
- 11
0
votes
0 answers
Randomisation with reducing, but increasing restriction
I'm trying to pick random positions, but also ensure subsequent random positions aren't close to prior positions. In this instance, just adjacent "cells" are removed, but I'd be intrigued how to make this wider, too.
There's probably been similar…

Confused
- 6,048
- 6
- 34
- 75