Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
I second Hakase's request. Post your collision code between the ball and bat here. That way we can see if there is anything that jumps out as being a problem.
My guess without any information provided would be that your ball and bat are freezing because they are "stuck" in an endless collision. So depending on how your rebounding works they might be just back and forth rebounding.
Also a question, can you still move the bat at all during this situation? As in, is it entirely unresponsive to controls when the collision occurs or can you move the bat, but the ball just stays stuck to it?
Sprite: spr_bat
Solid: true
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Collision Event with object obj_wall:
start moving in directions 000010000 with speed set to 0
Collision Event with object obj_ball:
for other object: bounce not precisely against solid objects
Key Press Event for <Left> Key:
start moving in directions 000100000 with speed set to 15
Key Press Event for <Right> Key:
start moving in directions 000001000 with speed set to 15
Key Release Event for <Left> Key:
start moving in directions 000010000 with speed set to 0
Key Release Event for <Right> Key:
start moving in directions 000010000 with speed set to 0
This is the information for the bat, which is what has the collision set. It doesn't matter if it's on the ball sprite or the bat, it's still the same thing. And no, I cannot move the bat once this happens. It just stays still, with the ball spinning in place. If I remove the collision, it works fine.
I managed to get it to work properly, but now, it waits 2 seconds before launching straight up (Which, I've set it to go to the upper right when the instance is created.), and if it goes off screen, it makes a new instance of the idle ball, but it's 2-3x larger, and moves faster as a result, as well as taking 5 seconds to launch.
http://steamcommunity.com/sharedfiles/filedetails/?id=769480473
If you haven't already done so... you should check out the tutorials that come with Gamemaker. One of the beginner tutorials is called "Coding Breakout" and it is exactly the kind of game you are coding.
In that tutorial, in the ball object there is a collision event for the paddle with this code in it...
A breakdown of whats going on there...
"other", just in case you weren't aware already, refers to the other object in a collision. Since the collision event is inside the ball object and for a collision with the paddle other in this case means the ID of the paddle object.
dir = point_direction(other.x, other.y, x, y); - This code is checking the direction (angle of facing) from the paddle to the ball.
scr_move_out(dir, other); - This is moving the ball object until it is no longer in collision with the paddle. The ball is move in the direction determined by the point_direction function just above it. So here that means its moving the ball directly away from the paddle until its no longer in contact. Something like this would address your initial problem of the ball being stuck when the collision occurs.
The remaining lines are simply telling the ball which directions its allowed to bounce off, setting its speed, and apply some additional motion away from the paddle.