View Full Version : Arkanoid and paddles
Moham
02-08-2003, 07:14 PM
Hola.
I've started to work on a Arkanoid/Breakout clone as my first project. I'm using Omega and everything is going alright. I have the paddle following the mouse and this is how i want it to be, but it looks so wrong with those quick stops when you stop moving the mouse. So i need some friction to make the paddle continue to move smoothly for a bit.
The paddle will also be movable in the Y direction, not the whole screen though but a little bit to make it possible to hit the ball harder and thus making the ball accelerate.
I'm terrible at math and have no experience with physics, so any help
regarding these questions will be greatly appreciated. Some examples would be great aswell :)
Eriken
04-08-2003, 10:06 AM
A few questions in order to get a clear picture, the paddle follows the x,y-coords of the mouse (as in, x,y on paddle is the same as x,y on the mouse?)?
it looks so wrong with those quick stops when you stop moving the mouse. So i need some friction to make the paddle continue to move smoothly for a bit.
What about those moving left, and then moving right, those quick changes look abit weird too? :-)
I think I would have created a variable for the paddle called SpeedX and decrease it from 0 when moving left.. and increasing it when moving right.. and then when there is no movement just count back to zero and move it accordingly.
Maybe I'll have to try this at home (I'm at work :twisted:) and see if it works ;-)
_____
Eriken
Alimonster
04-08-2003, 10:48 AM
I'll give you an example project when I get home in a few hours, assuming I can kick my flatmates off the computer long enough and that I can stop being so goddamned lazy.
Moham
04-08-2003, 04:56 PM
First of all, looking forward to the examples, and thanks for reading and helping me out :)
A few questions in order to get a clear picture, the paddle follows the x,y-coords of the mouse (as in, x,y on paddle is the same as x,y on the mouse?)?
Omega Input is working a bit differently. I dont know how to get the cords from the mouse with omega, but it works like this. Whenever the mouse moves, omegainput gives the amount of pixels it's moved, so by adding the numbers to paddle.X you get it to move. (Kinda hard to explain though :))
What about those moving left, and then moving right, those quick changes look abit weird too?
I think I would have created a variable for the paddle called SpeedX and decrease it from 0 when moving left.. and increasing it when moving right.. and then when there is no movement just count back to zero and move it accordingly.
Moving from left to right very quicly is what i want to avoid with friction to add some kind of challenge :) It will also be there to make the Paddle feel heavy.
I have speed as it is, but the problem is to determine what speed the paddle actually was before it was stopped and apply the friction to that. As the omegainput works the way it does i can get the amount of pixels before it was stopped (before it was 0) and that is what i have worked on. But as this number pretty much never exceeds 1-4 the friction is minimal. I've made it to work by moving the mouse fast, and then relase my hand from it. This makes a number like 15, but who would play like that? =)
So I guess i need to get the speed a bit before it was slown down. When experementing myself i seem to speed down the mousemovement even when doing fast motion before i stop the mouse completly by looking at the numbers i get.
Another problem with this is if you move the mouse slowly and the value i get is 0 the computer thinks i'm not moving the mouse, but to me it feels like moving it slowly, and when this happens my friction kicks in and makes the paddle move faster than i actually move it :)
It's gonna be a bit of a struggle to get this to work, but i think it's doable :)
Alimonster
04-08-2003, 09:24 PM
Well, that's the small example (http://www.alistairkeys.co.uk/download/PaddleThingy.zip) (150K) uploaded. Hope it does what you need! I've used the keys though, rather than mouse movement. Use the left and right cursor keys to move the thing, and S to stop the paddle. Note that I've not curtailed the max speed possible, IIRC - to do that, just add an if around the line which actually changes the paddle's position.
joyrider
18-12-2003, 04:13 PM
the zip is corrupted (only 100k big)
Paulius
18-12-2003, 04:22 PM
Works fine for me, maybe someone has an even worse internet provider then I have :)
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.