Page 1 of 1

I Need help

Posted: Tue Jan 17, 2012 3:13 am
by nicholas.aycockGA5787
I am a beginner and I am going to make my own game. I am enrolled in the academy
and I would like to know if there is a way to draw a line with your mouse and have
an object that is being shot out of a cannon hit that line and bounce off. There
will be different color lines representing the different bounciness. Is this
possible with live code and if so is there a tutorial in which I can figure this
out?

Re: I Need help

Posted: Tue Jan 17, 2012 3:20 am
by dunbarx
Easy and fun. It will take a bit of experimentation. That is the fun part.

Read up on the "intersect" function and the "within" function in the dictionary.

Write a script that moves an object around on the screen, and checks to see if there are any collisions. Don't let the object get lost.

Write back when you are good at doing that. Or when you cannot even get started.

Craig Newman

Re: I Need help

Posted: Tue Jan 17, 2012 3:43 am
by nicholas.aycockGA5787
Thank you for that and thanks in advance for any other advice.

Re: I Need help

Posted: Sun Jan 22, 2012 4:29 pm
by robbiefowlerGAIPLH
nice answer

Re: I Need help

Posted: Mon Jan 23, 2012 5:21 pm
by raulvelazquez
On a tutorial, from RunRev, it said that the intersection function requires a lot of processing, and is a good idea to use it only if needed.
In that example with an if statement it checked first if the object was close to where it could intersect, and then it use it.
Good idea to know that while coding!

Re: I Need help

Posted: Mon Jan 23, 2012 7:34 pm
by dunbarx
I cannot imagine speed or processor burden is an issue with any sort of real-time LC action.

Let me know if I am wrong.

Craig Newman

Re: I Need help

Posted: Mon Jan 23, 2012 7:50 pm
by raulvelazquez
That was said on the Game Academy, to tell you the truth, Im not sure how much it will impact the app.
Anyone instructor from the Academy to make this clear?

Thank you!

Re: I Need help

Posted: Tue Jan 24, 2012 5:00 am
by kdjanz
I believe that the discussion was in the context of Galactic Gauntlet. It uses about 40 pieces for the lower terrain, 40 for the upper foreground and you can have 40+ enemies on the screen, so each frame needs to check 120+ intersections if you brute force it. By using selective IF statements to quickly exclude the 80 pieces that could not possibly intersect as too far away horizontally or vertically, you can save the cycles for the intersects that you truly need. Especially since the intersect uses an alpha transparency comparison, you're dealing with a lot of pixels, so you might as well use a little intelligent optimization where you can.

As someone else said, every cycle you save now gives you more horsepower for v2.0 where there are more sounds, more graphics and faster game play. So you might as well do it now even if the CPU can handle it all right now.

Kelly

Re: I Need help

Posted: Tue Jan 24, 2012 7:02 am
by raulvelazquez
Thanks for the clarification, and yes, that game was the one I was talking about.