I've just started my adventure with Swift and I am writing my first game since Sunday. It's almost done but... I can't find one command on the internet. I need to detect a collision between 2 `SKPhysicsBody's which are a part of the player. One is named player and another player2. I want to make them stop their movement when they touch each other. I am writing from the phone right now so later I will publish a part of code that I am talking about if it's needed. Thanks for help guys!
Asked
Active
Viewed 146 times
0
-
2about 1000 questions like this already asked – Knight0fDragon Oct 05 '16 at 01:43
-
None of them have an exhaustive, thorough, guiding answer. That I know of. Tutorial sites don't ever start from a point of wisdom, that's the opposite of how tutorials work. Apple's docs are terrible, and the specific nature of SO makes it hard to find general information. I'd say this is where SO.docs could be useful, but it's (seemingly) a ghost town. @Knight0fDragon – Confused Oct 05 '16 at 02:56
-
1@Confused https://www.raywenderlich.com has a lot of great examples to start – Knight0fDragon Oct 05 '16 at 02:57
-
I didn't name ray's site, but my comments about tutorial sites above is targeted directly at that type of site. They completely fail to provide overviews, holistic understanding, share wisdom or care about the reader. They're tutorial sites. @Knight0fDragon – Confused Oct 05 '16 at 02:58
-
LOL they are tutorials not college credit classes @Confused,it provides the basic to get things going, it is not suppose to teach you about the art of programming – Knight0fDragon Oct 05 '16 at 03:00
-
College classes aren't much better, lectures are arguably worse. Tutorials don't provide a base to get things going, they do the absolute opposite of that. Tutorials provide a monkey-see-monkey-do tunnel vision perspective. Nothing more. @Knight0fDragon – Confused Oct 05 '16 at 03:02
-
@Confused dude you need to apply your own critical thinking, you can't have everything handed to you. Monkey see monkey do is how people get started, first you do it, then you are taught why you are doing it, then you are taught the techniques to doing it, finally you apply your own critical thinking into the mix, Now teach others. Congratulations you went from apprentice to master. – Knight0fDragon Oct 05 '16 at 03:06
-
Dude... programming has the worst literature of any field of endeavour on this earth. If you applied a little diversity to your reading, you'd find that to be so true as to be astonishing. Programming is the only field where what you've claimed about starting from monkey-see-monkey-do is at all acceptable. @Knight0fDragon This is simply because the lack of communication skills in programmers is legion. – Confused Oct 05 '16 at 03:07
-
@Confused That is not true, have you ever worked at a job lol, you can't be running the show on day one, you need to do monkey see monkey do to start understanding the business – Knight0fDragon Oct 05 '16 at 03:09
-
@Confused, example running a register, you watch somebody operate the register (because you do not know what the keys do), then they tell you why you do certain things (e.g. to prevent theft), then you are taught techniques (stack all bar codes facing up for faster scanning), finally, use your own technique (stack them all facing the same direction) – Knight0fDragon Oct 05 '16 at 03:14
-
I'm not making any claims about where or how someone should start understanding a business, or programming. I am stating the obvious - that tutorials are patently ineffective at sharing understanding, insight, wisdom and any perspective. Tutorials are the last resort of the untalented communicator, that's why tuts are run by undergrads, wherein no communication experience or ability is assumed or required. They're nothing more than a facilition mechanic for someone knowing a little more to do live Q&A sessions with lower grade undergrads @Knight0fDragon – Confused Oct 05 '16 at 03:15
-
@Confused, that is not the point of most tutorials, they are to get you started. You want to learn insight wisdom and perspective, you need to read books, attend lectures, talk to people in the field, hop into chat rooms and debate, etc etc. SO is not the place for any of these lol. SO is a Q&A site only, basic goal is to solve problems. In the process of problem solving thought you may get some insight and wisdom – Knight0fDragon Oct 05 '16 at 03:19
-
@Confused SteveIves technically has a bad answer there, but I would not down vote it due to the insight, and the question is terrible – Knight0fDragon Oct 05 '16 at 03:20
-
I disagree. @Knight0fDragon, knowledge can be shared succinctly, brilliantly and with great empowerment to the reader in very little time: Take a look at Steve Ives answer here, this is the beginning of sharing a wide perspective, profound insights and a general understanding of how physics works: http://stackoverflow.com/a/39832472/2109038 – Confused Oct 05 '16 at 03:20
-
@Knight0fDragon if you only look at it as an answer, it might be wrong. But as what I'm describing it as, it's the best beginning point to understanding physics in Sprite Kit I've seen. It rapidly introduces the array of liabilities and obligations involved in getting physics to work. – Confused Oct 05 '16 at 03:22
-
@Confused, any tutorial goes over what he says, and not everybody wants to repeat the same things over and over again – Knight0fDragon Oct 05 '16 at 03:24
-
Which takes longer and involves more repetition: Steve's bullet points or several narrow scope tutorials? @Knight0fDragon – Confused Oct 05 '16 at 03:25
-
The ideal is a hybrid of bullet points and graphics explaining the relationships, obligations and potentials of any given system. SpriteKit Physics is a system within a system within a language. So a couple of diagrams should cover it, with a couple of bullet point lists and a couple of explanatory paragraphs. Give me a week or so of using it, and I'll probably be equipped to do it. I'm still struggling with bitmasks and category masks or whatever that's all called. – Confused Oct 05 '16 at 03:28
-
@Confused Steves bullet points is a crutch, it is something you should be learning on your own. If you are that much of a novice that you need those bullet points, then you should be analyzing the tutorial and trying to understand where you went wrong, that is how you learn. Then overtime you end up saving time because you do not need to run though his list, because you have it memorized. – Knight0fDragon Oct 05 '16 at 03:30
-
@Confused, you are asking way too much, you want stuff like that, you need to purchase some books – Knight0fDragon Oct 05 '16 at 03:31
-
@Knight0fDragon "Dude... programming has the worst literature of any field of endeavour on this earth" I have purchased many books. They're universally terrible. The best is Matt Neuburg, and he's hamstrung by not having an engaged editor and (seemingly) being permitted (and encouraged) to forever add more words. – Confused Oct 05 '16 at 03:33
-
@Confused sounds to me the problem isn't the authors, it is you, I have read several books of a wide variety of types, going from holding your hand programming to hard core man page manual programming. You need to find the authors that work best for you. I personally like the O'Reilly line of books, it is a good mix in-between. I do not know of any Cliff Notes style programming books you are looking for, and I can't imagine it existing. BTW, most programmers do not think graphically, that is why books are like that, it is why people love the damn console so much – Knight0fDragon Oct 05 '16 at 03:39
-
@Confused - do what I did when I decided to learn Sprite-Kit (which was like, 5 months ago) - start with Ray's Sprite-Kit beginner's tutorial (https://www.raywenderlich.com/119815/sprite-kit-swift-2-tutorial-for-beginners). Then try a couple of his other tutorials. Make sure you understand *every* line of code - you'll have to look things up. Unfortunately, anything computer related involves being able to find, read & understand the documentation. It's a fundamental IT skill (I write OS extensions in Assembler for IBM mainframes during the day). Ray's 2D games book is very good too. – Steve Ives Oct 05 '16 at 07:46
-
@Confused. Apple's class reference documentation (e.g. 'SKSpriteNode class reference' - is actually very good, but it's a reference guide, not a user guide. There's good information in Apple's 'SpriteKit Programming Guide' (https://developer.apple.com/library/content/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40013043-CH1-SW1 )and in the WWDC videos.(https://developer.apple.com/videos/wwdc2016/). – Steve Ives Oct 05 '16 at 07:52
-
@SteveIves You're missing my point. Programming (as a field) has the worst literature and documentation of any. This stems from the nature of programmers: they're greatly capable mentally/internally, but not good at expressing themselves, empathising with others and externalising things for general benefit. Programmers retain and connect hundreds of things within complex mental maps. Even if programmers wanted to communicate their knowledge and understanding, what they conceive and understand is so intricate and massive it requires great communication skills to impart; skills most don't have. – Confused Oct 05 '16 at 13:36
-
Look at what I'm saying here, @SteveIves: http://stackoverflow.com/questions/39861269/how-to-detect-collision-in-swift?noredirect=1#comment67017582_39861269, you're beginning to refine and articulate an easily digestible, general purpose, accessible introduction, overview and checklist for setting up and working with physics. Hard won knowledge and insights are being parsed and passed, by you, very well. In the answer I link to there. And it's a great starting point for the OP, the best that I know of. Good writing comes from refactoring and code reduction, over and over and over again. – Confused Oct 05 '16 at 13:42
-
I don't think that programming documentation is any worst than that for brain surgery, medicine or nuclear reactor construction. The point I'm making is that Sprite-Kit IS REALLY COMPLICATED! You need to know how to program, how to program in Swift (these are not the same things), object-orientated programming, iOS and sprite-kit and Xcode. There really isn't a simple guide. I found RW's starter tutorials very easy to follow. Do the one I mentioned and come back with the bits you can't follow. Sorry if this sounds patronising, it isn't meant to be. What's your level of programming experience? – Steve Ives Oct 05 '16 at 13:43
-
you're still missing my point. – Confused Oct 05 '16 at 13:43
-
I have a simple SpriteKit project that does contact and collisions - I'll try and put it the in the SK docs here. – Steve Ives Oct 05 '16 at 13:46
-
and there's not only no correlation between real sciences and programming, there's absolutely no relationship between their literature and that of programming. Any attempt to compare any rigorous field of endeavour with programming will only reveal programming for the nails and superglue it really is. – Confused Oct 05 '16 at 13:46
-
@SteveIves I don't doubt a demo project will be helpful, to some. But what's extraordinary about your answer is potentially profound. It's the first collation of introduction, examination, explanation and extrapolation of the dependencies and obligations of setting up and using physics in Sprite Kit. If you want to contribute to the future readers, the best thing to do would be continue refining and mastering that articulation. It's close to being a beautiful, absorbing, insightful resource, already leagues better than anything else from any other source. It's shockingly succinct and profound! – Confused Oct 05 '16 at 13:52
-
@SteveIves I'm talking about this: http://stackoverflow.com/a/39832472/2109038 – Confused Oct 05 '16 at 13:53
-
@SteveIves No. Thank you! On behalf of all that follow and find your articulations on physics and SpriteKit. Your ability to devolve (what is mostly arbitrary and poorly designed) complexity to this simplistic, easily accessible, instantly digestible, comprehensible format - it is a gift to everyone! Thank YOU! – Confused Oct 05 '16 at 16:24
-
@Confused - thanks very much. I'll try and add something similar to the demo project here : http://stackoverflow.com/documentation/sprite-kit/6261/sknode-collision/24162/simple-sprite-kit-project-showing-collisions-contacts-touch-events#t=201610051802463246836 – Steve Ives Oct 05 '16 at 18:03
-
Ouch, this shows some of the grotesque limitations of the SO.docs format. Collisions, Contacts, Categories and Events need a space of their own, collectively. I think. Good luck in that constricted environment. You've vastly more knowledge and talent than I'll ever know. – Confused Oct 05 '16 at 18:07