collision

jquery collision detection for divs

别来无恙 提交于 2019-12-11 08:45:55
问题 I'm trying to learn some programming with jQuery. I have a div that has 800 x 800 pixel dimensions. I have another 16 x 16 pixel div that I want to move within the bigger one using arrow keys. Problem is I can't get it to work properly, can someone please tell me what I'm doing wrong. Moving left works, it stops the 16x16 div if css attribute "left" is under 0px: $(this).keydown(function(e) { if (e.which == '37' && ($('#p1').css('left') > "0px")) { $('#p1').css('left', '-=16px') } }); Moving

libGDX - Trying to implement collision between 2 sprites

断了今生、忘了曾经 提交于 2019-12-11 07:52:05
问题 what the title says basically Bit of background about the current game: Player is always moving from left to right, if the screen is tapped he jumps if it's dragged he dashes forward. I added a tile (Platform object) and am now trying to make my Player stop moving if he hits it. The Player starts on the bottom left of the screen, and the Platform is on the top right. What happens is that the Player stops when he reaches the middle of the screen, rather than the actual Platform. Can anyone

Implementing per pixel collision on rotated sprites

有些话、适合烂在心里 提交于 2019-12-11 07:27:00
问题 I am building a 2D game in XNA using C#, and I am using sprites that will track the player's position and rotate accordingly in the spritebatch.Draw() method. I am now trying to implement per-pixel collision detection, and I believe that the rotation of the sprites is throwing it off. The collision checks are as follows. private bool collision(Rectangle object1, Color[,] dataA, Rectangle object2, Color[,] dataB) { if (object1.Bottom < object2.Top) return perPixel(object1, dataA, object2,

Collision detection in vb.net

落花浮王杯 提交于 2019-12-11 07:11:37
问题 I am trying to recreate Copter in visual basic, so far I have the player, roof and helicopter but I can't seem to get the game to end when the player touches the floor or roof. Sorry for posting so much, this is my first time on here and I didn't know what to paste. Any help is appreciated :D Public Class Form1 Dim pb_field As PictureBox Private Sub create_field() pb_field = New PictureBox With pb_field .Top = 20 .Left = 20 .Width = 500 .Height = 300 .BackColor = Color.Black End With Me

Tilemap Collision SFML C++

好久不见. 提交于 2019-12-11 06:58:46
问题 I've spent many frustrating hours and cannot figure this out, i understand collision and have it working until i try to implement gravity, i cant seem to set the player position after it hits the tile map, falling through the ground is my problem, x axis a variation of the following code works fine if (background.colMap[tiles[i].y][tiles[i].x] == 1) { playerSpeed.y = -0.f; playerSprite.setPosition(playerSprite.getPosition().x, playerSprite.getPosition().y - 1); inAir = false; } I though by

Actionscript 3 pixel perfect collision. How to? (learning purposes)

前提是你 提交于 2019-12-11 05:33:29
问题 I know that there are people out there creating classes for this (ie http://coreyoneil.com/portfolio/index.php?project=5). But I want to learn how to do it myself so I can create everything I need the way I need. I've read about BitMap and BitMapData. I should be able to .draw the MovieClips onto a BitMap so I could then cycle the pixels looking for the collisions. However, It's weird and confusing dealing with the offsets.. And it seams like the MyBitMap.rect has always x = 0 and y = 0...

how do you get collision detection on different materials within an scn node

房东的猫 提交于 2019-12-11 05:33:27
问题 I'm trying to get collision detection between different materials within an scn node. I have a cube with 6 different materials/ colors and balls coming at the cube. I'd like to detect same and different colored collisions but don't know how to apply different categories to each material. import UIKit import SceneKit class GameViewController: UIViewController, SCNPhysicsContactDelegate { Can I create categories to assign to different sides of the cube later? let ballCategory = 0 let

XNA 3D Collision matrices not working

筅森魡賤 提交于 2019-12-11 04:06:48
问题 I previously asked a question about why my collision was not working. I got a good answer which makes sense: Apply the same transforms that I did in the DrawModel method to the isCollision method. This however, did not work. I was unable to figure out how to make the same transformations in the isCollision method. If anyone could help me, that would be great. Thanks! Here are the methods: private bool checkPlayerCollision(Model model1, Matrix world1) { //Make floor matrix Matrix floorMatrix =

Libgdx Melee Attack Collision Detection

China☆狼群 提交于 2019-12-11 04:03:22
问题 I have a 3D scene with 3D model instances; and I want to do collision detection. I'm currently following this tutorial (http://blog.xoppa.com/using-the-libgdx-3d-physics-bullet-wrapper-part1/). However, what I want is a bit more complicated. There's a character (a knight.g3db model that's part of the sample code from Libgdx basic 3d model class), and it can attack with a sword. I also have another model instance that I want to "attack" with the sword. Checking if the two objects for collision

Is there a way two make two trigger gameObjects collide?

Deadly 提交于 2019-12-11 03:12:07
问题 This is for a 2D game. I have a Player who can shoot trigger projectiles(with a trigger collider) and Enemies that can do the same. When a Player projectile collides with the Enemy, stuff happens and vice versa. However, when the Player projectile and the Enemy projectiles collide, they just ignore collision, go through each other, and nothing happens. They also have a Rigidbody2D with continuous collision detection. Is there a way to make it so something happens when these two gameObjects