arkanoid

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
kalkas
Posts: 13
Joined: Tue Feb 03, 2009 10:12 am

arkanoid

Post by kalkas »

hi
i want to make an arkanoid game.i want to keep it simple so i dont want to any physics.probably it will be with simple 3d graphics but in 2d motion in general.
i dont have yet wrote i single line.i am planning at the moment.i'd the the help of anyone,if he can,for some question i have

i think the code of the ball's motion will be something like this
it's going to have a X_speed and a Y_speed.the values of x and y i guess wil coming from a simple line function.
you know, if i want the ball to moving in 45o angle, then we'll have
x=a*y -> a=1 -> x=y

when the ball collides with the bricks the motion of the ball will change into this:

collides with the upper or the down edge of the brick -> x*=-1 (x for vertical,y for horizontal)
collides with the left or right edge of the brick -> y*=-1
(if i make mistakes correct me)

if collision occur between ball and paddle then proportionally how far from the center of the paddle were the collision,it will take and a concrete angle of move.

my questions of course are:
1)how can i check in which edge of the brick the ball hit
2)how can i calculate the distance from the center of the paddle to the collision
spot
Pyritie
Posts: 120
Joined: Fri Jan 16, 2009 12:59 pm
Contact:

Re: arkanoid

Post by Pyritie »

kalkas wrote:hi
i want to make an arkanoid game.i want to keep it simple so i dont want to any physics.probably it will be with simple 3d graphics but in 2d motion in general.
i dont have yet wrote i single line.i am planning at the moment.i'd the the help of anyone,if he can,for some question i have

i think the code of the ball's motion will be something like this
it's going to have a X_speed and a Y_speed.the values of x and y i guess wil coming from a simple line function.
you know, if i want the ball to moving in 45o angle, then we'll have
x=a*y -> a=1 -> x=y

when the ball collides with the bricks the motion of the ball will change into this:

collides with the upper or the down edge of the brick -> x*=-1 (x for vertical,y for horizontal)
collides with the left or right edge of the brick -> y*=-1
(if i make mistakes correct me)

if collision occur between ball and paddle then proportionally how far from the center of the paddle were the collision,it will take and a concrete angle of move.

my questions of course are:
1)how can i check in which edge of the brick the ball hit
2)how can i calculate the distance from the center of the paddle to the collision
spot
I suggest you start looking at some code because the things you just mentioned are very simple to do. The collision example is where you should look. :3
Hive Workshop | deviantART

I've moved to Ogre.
kalkas
Posts: 13
Joined: Tue Feb 03, 2009 10:12 am

Post by kalkas »

ok,show me the point in the collision example that speaks about distance from the center of a mesh or something about my first question.abobut the edges.
so simple that not worth mention it
smartie
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

use node->getTransformedBoundingBox().getCenter() to get the centre of a mesh
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Ein
Posts: 33
Joined: Thu Feb 12, 2009 11:39 pm
Location: UK - Matrix
Contact:

Post by Ein »

I too would like to create a simple game like this, it would be usefull if someone where to write a tutorial. I will attempt to write one on the wiki or my site once I have had a deeper look into this.
Ein knowledge seeker
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

You did see the examples in the SDK? Did you understand them? It should be no problem to do a simple game with that knowledge.
I suggest -> try to create that game and ask specific questions as you discover problems. Before that do the tutorials.

(For bigger games you should NOT just start and see what happens, but thats not the case here)
kalkas
Posts: 13
Joined: Tue Feb 03, 2009 10:12 am

Post by kalkas »

ok,if i could kill someone through this forum,that would be Pyritie and geckoman.
you geckoman,did you read my question?did you understand them?
i did read the tuts i did understand them.i know how to do a f*cking collision check.my f*cking question is:
when the ball collides with a brick,how do i know which of the brick's side the ball touch??
and i suppose the most of you in here had played once arkanoid.when the ball collides with the paddle,if the ball touches the very edge of the paddle,reflects and takes different course and if touches the center of the paddle different.
i dont need to write any code.those are my question and i can't continue if i can't answer them.
and i don't want to hear any smartash again say to me to read the tuts.
i you don't know the answer just shut the f*ck up and don't reply you f*cking piece of sh*t[/quote]
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You're probably not gonna get much more help after that little outburst ;)
Image Image Image
kalkas
Posts: 13
Joined: Tue Feb 03, 2009 10:12 am

Post by kalkas »

that's bad because before the outburst i took so much help that i could write new windows by myself
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

dude... grow up!
Image Image Image
kalkas
Posts: 13
Joined: Tue Feb 03, 2009 10:12 am

Post by kalkas »

r u kidding me?
seriously
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

yes it's a zoo...
make me laugh though...
man seriously you really get the top position, that would be zoo manager... EDIT3: alternatively you could also be the 'Chimpanzee'

wow, still laughing... From all posts in all 'serious' forums I've ever read in my entire 30 year life, yours definitly is the most (still searching for the right word), well the wrongest of wrong ways to ask a question...

To your problem... I'm not sure if detecting the edge of the paddle mesh or block you hit really helps or just complicates the matter... all you need to check to make the behaviour your suggesting is the distance from the centre of paddle and/or block... but that really wouldn't be relevant either because the only thing that really matters is the angle since:
http://en.wikipedia.org/wiki/Reflection_(physics) <-dont know why the link won't work
Image
The angle which the incident ray makes with the normal is equal to the angle which the reflected ray makes to the same normal.
And like most problems here, again that would be a matter of properly understanding vector math, I suggest some reading, AND anger management...
EDIT: changing + to - and vice versa will get you quite far, maybe you make a demo with at least that behaviour before attempting to continue with arkanoid typical distorted physics... looking at the triangle selector in the api you should be at least able to get the number (index) of the face you hit
EDIT2:
No thats the law of reflection, but applying it, calculating angles and changing the direction of motion is best done when understanding vector math...
http://www.geocities.com/SiliconValley/2151/math3d.html
http://chortle.ccsu.edu/VectorLessons/vectorIndex.html
Last edited by zillion42 on Wed Feb 18, 2009 1:29 pm, edited 3 times in total.
Ein
Posts: 33
Joined: Thu Feb 12, 2009 11:39 pm
Location: UK - Matrix
Contact:

Post by Ein »

Thanks zillion I knew it would be something like that, i've been thinking that it might besomething along those lines but I couldent, put my finger on it.

This is vector maths? time for some google-ing.

I think that it is the "(" in the link that the forum dosent like.
Thanks,
Pete
Ein knowledge seeker
kalkas
Posts: 13
Joined: Tue Feb 03, 2009 10:12 am

Post by kalkas »

lol
f*cking geeks
zillion42
Posts: 324
Joined: Wed Aug 29, 2007 12:32 am
Location: Hamburg, Germany

Post by zillion42 »

keep it up and you will most probably be banned
Post Reply