collision-detection

SpriteKit Incorrectly Detecting Multiple Collisions

血红的双手。 提交于 2020-01-23 17:10:39
问题 I have been going through a SpriteKit tutorial that makes a Flappy Bird Style Game. One of the issues I am having, is that it is firing off the code for collision detection incorrectly. Sometimes, this goes perfect...it hits the ground, it fires the method for when it collides with the ground. However, at seemingly random times, it will hit the ground, and fire off the method for ground collisions anywhere from 2-6 times. It doesn't matter if any other nodes are present on the screen or not.

SpriteKit Incorrectly Detecting Multiple Collisions

浪尽此生 提交于 2020-01-23 17:10:10
问题 I have been going through a SpriteKit tutorial that makes a Flappy Bird Style Game. One of the issues I am having, is that it is firing off the code for collision detection incorrectly. Sometimes, this goes perfect...it hits the ground, it fires the method for when it collides with the ground. However, at seemingly random times, it will hit the ground, and fire off the method for ground collisions anywhere from 2-6 times. It doesn't matter if any other nodes are present on the screen or not.

jquery .animate() collision detection

﹥>﹥吖頭↗ 提交于 2020-01-23 12:49:27
问题 I'm using animate to move a div within a grid of divs. As a test I am setting some of the grid divs as obstacles. If the animated div collides with one of the obstacles I want to end the animation. A plug in is fine or a snippet of code. I kind of suspect I am sniffing up the wrong tree with .animate() so any shove in the right direction or improvement on what I am doing is appreciated: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1

jquery .animate() collision detection

有些话、适合烂在心里 提交于 2020-01-23 12:49:10
问题 I'm using animate to move a div within a grid of divs. As a test I am setting some of the grid divs as obstacles. If the animated div collides with one of the obstacles I want to end the animation. A plug in is fine or a snippet of code. I kind of suspect I am sniffing up the wrong tree with .animate() so any shove in the right direction or improvement on what I am doing is appreciated: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1

Move rectangles so they don't overlap

我的梦境 提交于 2020-01-22 19:47:43
问题 This is a half programming, half math question. I've got some boxes, which are represented as four corner points. They are true rectangles, the intersections of two sets of parallel lines, with every line in each set at a right angle to both lines in the other set (just so we're clear.) For any set of n boxes, how can I efficiently calculate where to move them (the least distance) so that they do not overlap each other? I'm working in javascript here. Here's the data: //an array of indefinite

Detect collision of two UIView's in swift

妖精的绣舞 提交于 2020-01-19 16:23:29
问题 I have two UIViews on my ViewController. I added panGesture to first view and when i start moving this view the second view will move towards first view. I want to detect an event when these two views collides. Here is my code. @IBAction func dragFirstView(sender: UIPanGestureRecognizer) { let translation = sender.translationInView(self.view) dispatch_async(dispatch_get_main_queue()) { () -> Void in UIView.animateWithDuration(2.5, delay: 0.0, options: UIViewAnimationOptions.CurveEaseOut,

how to use box2d for collision detection in cocos2d-x

一笑奈何 提交于 2020-01-17 08:30:32
问题 my two sprites are roll and hero. i want to detect their collision using box2d in cocos2d-x i have got both the sprites moving on the screen (roll automatically, hero manually). all i want to do is call the function intersection(); when the two sprites collide. (sprites are declared globally in the *.h file) #include "GameScene.h" #include "HomeScene.h" USING_NS_CC; CCScene* GameScene::scene() { // 'scene' is an autorelease object CCScene *scene = CCScene::node(); // 'layer' is an autorelease

Rectangle.IntersetsWith() returning true whenever the two rectangles are on the same X axis

女生的网名这么多〃 提交于 2020-01-16 13:27:34
问题 I'm trying to recreate Battleship and I'm using Rectangle.IntersectsWith() to find collisions between each ship. Whenever I put the ships on the same x axis on the grid, the function returns true. It doesn't if they are on the same y axis or if they are touching. This is the code I use to test every ship against every other ship (If you know of an easier way, I'd love to hear about it). Public Sub CheckForCollision() Dim ships As Ship() = _ {AirCraftCarrier, Battleship, Submarine, _ Destroyer

Cocos2d-js: effect on cocos2d-js application running on browser while a move from one application to another application

时光毁灭记忆、已成空白 提交于 2020-01-16 03:24:25
问题 i was running parkour game given on cocos2d website on my browser. everything was working fine, but when i move from my browser to sublime text and returned to my browser, the running player start to show some unexpected behaviour, the player disappeared from its position and and after few second it fall on the ground and then start running again .whenever i move from one application to another it happens. i don't why its happening. could some one tell me how to prevent this from happen? here

SFML Bounding Box Collision Detection

故事扮演 提交于 2020-01-13 18:55:16
问题 I am trying to write a very basic game for my first SFML project. Its a robot with a jointed arm that will be able to pop balloons with his hand only. The problem I am having is that when checking to see if the pincer sprite intersects with the balloon sprite , it returns true all the time, regardless of the placement of the balloon or the robot pincer. I am using transform to place the various parts of the robot arm, and this is whats causing the problem I think, but I don't know why. I have