collision-detection

Detecting if a specific sprite was touched on Cocos2d-iphone

不羁岁月 提交于 2019-12-01 06:50:16
问题 I was following Ray`s tutorial for making a simple iPhone game (here: http://goo.gl/fwPi) , and decided that i wanted the enemies to be eliminated when they get touched. My initial approach was to spawn a small CCSprite sprite on the touch location, then use CGRectMake to create a bounding box of said sprite to detect if the enemy sprite was touched. Much like Ray does with the projectile/enemy. But of course, my way of doing it isnt working and i cant dig myself out of this hole. Here is the

Detecting wether a point is inside or outside of a raphael.js shape

纵然是瞬间 提交于 2019-12-01 06:32:01
问题 I have a raphael.js shape which I am plotting circle's on top of. I only want a circle to appear if the circle does not go off the boundary of the shape it is being plotted on to. To make this more clear, here is an example of what I do not want to happen: Example http://img682.imageshack.us/img682/4168/shapeh.png I want the circles outside of the grey area not to appear. How would I detect wether a circle is inside or outside of the grey shape? 回答1: You could just apply a clip-path (that

2D Platformer Collision Problems With Both Axes

让人想犯罪 __ 提交于 2019-12-01 05:56:44
I'm working on a little 2D platformer/fighting game with C++ and SDL, and I'm having quite a bit of trouble with the collision detection. The levels are made up of an array of tiles, and I use a for loop to go through each one (I know it may not be the best way to do it, and I may need help with that too). For each side of the character, I move it one pixel in that direction and check for a collision (I also check to see if the character is moving in that direction). If there is a collision, I set the velocity to 0 and move the player to the edge of the tile. My problem is that if I check for

collision detection

你。 提交于 2019-12-01 05:49:47
问题 HI everybody, how can i carry out "collision detection" in my app,which just like this: http://www.gskinner.com/blog/assets/CDTest.swf Give me some advices,,please.. 回答1: Have a look at CGRectContainsPoint and CGRectIntersectsRect . 来源: https://stackoverflow.com/questions/3584810/collision-detection

Collision with shapes other than rectangles..?

无人久伴 提交于 2019-12-01 04:56:46
问题 I'm so used to working just with rectangles for collision detection that I'm a bit stumped right now. I'm working with diamond-like shapes, and for the past few hours, have been trying to figure out how to check for collision. I tried checking to see if the first objects four points are inside the points of the second object, but that just makes a box (I think) The reason why I feel like I'm having difficulty with this is because of the angles. 回答1: You're trying to collide a moving convex

Delphi custom animation - collision detection

本秂侑毒 提交于 2019-12-01 03:32:44
I'm working with custom drawing / 2D animation and I'm trying to figure out how to detect when the moving object collides with a wall in the map. User holds arrow keys on the keyboard to move the object, and the map is stored as an array structure of points. The walls in the map may be angled, but no curved walls. Using the map structure ( FMap: TMap; ) in my code below, in the DoMove property, how do I detect if the object is colliding with any wall in the map and prevent it from moving through? In DoMove , I need to read FMap (refer to DrawMap to see how FMap works) and somehow determine if

Detecting Rectangle collision with a Circle

妖精的绣舞 提交于 2019-12-01 01:07:01
I have a Circle with a center point (Center_X, Center_Y) and I am detecting if a rectangle falls into it's Radius (Radius). How would I be able to perform this task? I have tried using if (X - Center_X)^2 + (Y - Center_Y)^2 < Radius^2: print(1) Then I try to draw a circle to fit over this area: Circle = pygame.draw.circle(Window, Blue, (Center_X, Center_Y), Radius, 0) But it doesn't seem to line up. Is there something I am doing wrong? Here's what I was describing in my comments, plus changes to correct handling of the case of a circle inside a larger rectangle which Michael Anderson pointed

Delphi custom animation - collision detection

馋奶兔 提交于 2019-12-01 00:15:52
问题 I'm working with custom drawing / 2D animation and I'm trying to figure out how to detect when the moving object collides with a wall in the map. User holds arrow keys on the keyboard to move the object, and the map is stored as an array structure of points. The walls in the map may be angled, but no curved walls. Using the map structure ( FMap: TMap; ) in my code below, in the DoMove property, how do I detect if the object is colliding with any wall in the map and prevent it from moving

Resolving a Circle-Circle Collision

与世无争的帅哥 提交于 2019-11-30 23:06:31
I am writing software that extends Circle-Rectangle collision detection (intersection) to include responses to the collision. Circle-edge and circle-rectangle are rather straight-forward. But circle-circle has me stumped. For example, let two circles collide, one red and one green, in a discrete event simulation. We might have the following situation: Immediately after they collide we could have: Here RIP and GIP were the locations of the circles at the previous clock tick. At the current clock tick, the collision is detected at RDP and GDP. However, the collision occurred between clock ticks

check collision between certain divs?

一世执手 提交于 2019-11-30 21:25:44
Anyone know how to check for collision between certain divs? At the moment I'm using getBoundingClientRect() , but it checks for every div: if (this.getBoundingClientRect()) { animateContinue = 1; } How would I go about checking specific ones? Using this for loop I can get the IDs of the divs I want to check. for (var x = 1; x <= noOfBoxArt; x++) { console.log('#boxArt'+x); } Joey Morani Okay. Ended up using a modified version of this duplicate . The function which does the work is: var overlaps = (function () { function getPositions( elem ) { var pos, width, height; pos = $( elem ).position()