collision-detection

Collision detection in a 2D maze with thick walls

岁酱吖の 提交于 2019-12-10 07:27:40
问题 I have to make a game with Windows Forms for school. My game consists of a user having to get through a maze. I'm trying to prevent my user from going straight through the walls using collision detection, but am getting stuck because of the varying shape of the rectangles being used to represent walls. Here's an image of the game. This question may be similar to this one, however with my movement I believe that it is quite different, as I don't have a grid system or graphical map laid out. As

Inheriting from Transformable and Drawable in SFML

可紊 提交于 2019-12-10 04:29:35
问题 I'm trying to inherit from Transformable and Drawable in SFML in order to make my objects... well, transformable and drawable. I'm making a simple breakout game, but perhaps I'm going about this the wrong way. Here's my code: #include <SFML/Graphics.hpp> #include <SFML/System.hpp> class Player : public sf::Transformable, public sf::Drawable { public: Player(int x, int y); ~Player() {}; sf::RectangleShape p_rect; void doMovement(const sf::RenderWindow& window); sf::FloatRect getGlobalBounds()

Having some issues with making pacman?

谁都会走 提交于 2019-12-10 03:49:07
问题 Edit: Totally forgot to mention I'm coding in Java I'm having a real hard time making some kind of detection system or some way to make my pacman sprite/character move smoothly through my board in the game. I did not make the board it's a image. I had tried colour detection first which worked the best yet was not smooth at all and pretty choppy. I then tried to manual input coordinates of location not allowed to be entered. This also did not work out so well. I'm currently trying now to have

Cocos2d - How to check for Intersection between objects in different layers

走远了吗. 提交于 2019-12-10 00:30:17
问题 I'm currently developing a doodle-jump style game in Cocos2d for iPhone and have a scene set up with two different layers - game objects (platforms, collectables etc...) and player (character, controlled by the player). I have these in separate layers because I want to scroll the entire game objects layer down when the player jumps up - giving it the vertical, doodle-jump style feel. The problem is that intersection between the player and the platforms doesn't occur because they're on

XNA Collision Detection - Vector2.Reflect - Help Calculating the Normal of a Circle Sprite - C#

佐手、 提交于 2019-12-09 19:13:48
问题 I'm having trouble wrapping my mind around how to calculate the normal for a moving circle in a 2d space. I've gotten as far as that I'm suppose to calculate the Normal of the Velocity(Directional Speed) of the object, but that's where my college algebra mind over-heats, any I'm working with to 2d Circles that I have the centerpoint, radius, velocity, and position. Ultimately I'm wanting to use the Vector2.Reflect Method to get a bit more realistic physics out of this exercise. thanks ahead

How do I 'wrap' a plane over a sphere with three.js?

杀马特。学长 韩版系。学妹 提交于 2019-12-09 14:09:19
问题 I am relatively new to three.js and am trying to position and manipulate a plane object to have the effect of laying over the surface of a sphere object (or any for that matter), so that the plane takes the form of the object surface. The intention is to be able to move the plane on the surface later on. I position the plane in front of the sphere and index through the plane's vertices casting a ray towards the sphere to detect the intersection with the sphere. I then try to change the z

Javascript Collision Detection

孤街浪徒 提交于 2019-12-09 06:12:26
问题 I'm trying to make a snake game in javascript, but I am struggling with collision detection. I've tried various methods so far, but in desperation, have settled storing all the positions of the segments each frame then checking whether there are any duplicates before animating the next. This method hasn't proved successful either unfortunately. Perhaps this is due a misunderstanding of how JS treats arrays. For a while I was using if(x in y) but from what I can tell that returns if the exact

EaselJS - Best way to detect collision

谁都会走 提交于 2019-12-09 04:55:16
问题 I'm trying to find a good way for collision detection for my easelJS small app. I've just created 2 rectangle using createjs.Shape But after creating a rectangle shape, the API doesn't let me know the width and height of the rectangle (I don't know why). EaselJS Shape has a method called "hitTest" but it can only be used when you want to test collision of the shape and a point . //Here's the code http://jsfiddle.net/ZbZjL/16/. //Create a stage by getting a reference to the canvas stage = new

How do I delete an image after a collision in pygame?

亡梦爱人 提交于 2019-12-09 03:46:24
问题 I'm making a game involving powerups using python. There is a random chance of one spawning and it blits its image on the screen. it picks a random powerup from a list once the player's body (The captain in this scenario) collides with it. I'm checking the collision with a rectangle at the position of the image (Same size) and attempting to delete the rectangle, and the image once a collision happens. How can I do this? This is my attempt so far, however, I keep receiving the error: "List

collision detection for paddle (pong/breaking block game)

独自空忆成欢 提交于 2019-12-09 03:26:51
问题 I'm new to javascript, and trying to learn the collision detection for the paddle. This might be simple, but I don't know how to create collision detector of the paddle I created. How do this work and what do I have to put in order to create collision detection? (I don't need know about bricks, I just have to create simple animated/game javascript page.) Oh and do you know what kind of javascript am I using? because sometimes it is totally different coding so it's really hard to find my type