Posts

Post not yet marked as solved
0 Replies
525 Views
Hello everyone 👋 Currently to run my javascript in the terminal I use node as such: $ node hello.js Instead of Chromium I would like to use the webkit engine to test and debug my javascript in this manner. $ webkit hello.js I am not sure where to start looking and I am hoping someone here could be of assistance. Thank you for your time. // Björn Hjorth
Posted Last updated
.
Post not yet marked as solved
0 Replies
729 Views
Hello everyone, As the title says how can I make "quick help" to show on hover so I can skip the option(⌥) click part. Thank you. Björn
Posted Last updated
.
Post marked as solved
2 Replies
447 Views
Hello everyone,I would like to have so SKSpriteNodes can take care of there own contact detection.Much like Unity have there own `OnTriggerEnter` methods on there GameObjects.But I do not know how to achieve that in SpriteKit, some help would much appriciatedExample how I would "like" it to work:import SpriteKit class Ball: SKSpriteNode, SKPhysicsContactDelegate { func didBegin(_ contact: SKPhysicsContact) { print("INSIDE BALL: ",contact.bodyA.node?.name, contact.bodyB.node?.name) } init(x: Int, y: Int) { physicsWorld.contactDelegate = self ???? //setting up Physicsbody etc } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } }import SpriteKit import GameplayKit class GameScene: SKScene, SKPhysicsContactDelegate { override func didMove(to view: SKView) { physicsWorld.contactDelegate = self } func didBegin(_ contact: SKPhysicsContact) { print("INSIDE MAIN: ",contact.bodyA.node?.name, contact.bodyB.node?.name) }Or how do you manage large amount of contact logic?Thanks for any help and sorry if the questions is weirdly formulated
Posted Last updated
.
Post marked as solved
7 Replies
3.1k Views
Hello everyone, Take this exampel:let names = ["Zoey", "Chloe", "Amani", "Amaia"] let randomName = names.randomElement()!Why do I need to force unwrap this? I understand that randomElement maybe returns nil in the spec but as one can clearly see there are no chance that this will return nil.Also this example:[-10, 10].randomElement()I get error: Value of optional type 'Int?' must be unwrapped to a value of type 'Int'It makes no sense, I am sure the compiler must be smarter then this and I am making something wrong here.
Posted Last updated
.