Welcome, Guest. Please Login or Register.  • Help
SMF Underground
+ SHMUP-DEV » SHMUP DEV FORUMS » Training Grounds
|-+ Control Schemes [part 1] : Progear turrets

Pages: [1]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools  
Read February 10, 2007, 12:42:11 pm #0
motorherp

Control Schemes [part 1] : Progear turrets

Hello again.  My next tutorial is now posted up in the Tutorials section of the site.  You might be happy to know that this one is less complex that my last one but should let us do some pretty cool things with our games.  As usual I've created this thread so that people can come here to give me feedback and ask questions.  Enjoy.
Offline  
Read February 12, 2007, 06:57:47 am #1
relsoft

Re: Control Schemes [part 1] : Progear turrets

Cool!!! I'm in thed process of rewriting my bullet hell engine.

What I have right now could do progear's turrets and uses more physical movements (Ie. Acceleraion, gravity and friction).  But I'd like to see your take on that.

The more ways to do one thing the better. ;*)


Hello
Offline  
Read February 12, 2007, 01:34:14 pm #2
motorherp

Re: Control Schemes [part 1] : Progear turrets

Cool!!! I'm in thed process of rewriting my bullet hell engine.

What I have right now could do progear's turrets and uses more physical movements (Ie. Acceleraion, gravity and friction).  But I'd like to see your take on that.

The more ways to do one thing the better. ;*)


I'm glad you enjoyed it.  It was a simple one this time so not quite as in-sightful as my last tutorial.   I just wanted people to come away with an understanding of polar coordinates, what atan2 does, and how sprite perspective tricks can be used to make 2d games look less flat, since these will be techniques that will come in handy time and time again and lay the foundations for some ideas I have for future tutorials.  With regards to adding more motion into the turrets, if you look at Progear you'll see its not needed.  What I mean is that the turrets will use just the rotation code, but then the turrets themselves are like children objects which inherit the motion of their parent object which might include more complex motion.  For example you'll see that the tank bodies and turrets are seperate sprites and the turret will be treated as a child of the tank body (you can see how the perspective trick is used on the tank bodies too). 

Anyway this is touching on the stuff I want to cover in my next control schemes tutorial so stay tuned.  Dont hold your breath though, I'm having a little break to get kick started an amazing idea I had when writing the turret tutorial to do with bullet pattern creation and polar functions.  If it works I should have something really cool.  Dont worry though, I will return to the tutorials soon.

Edit: On second read it looks like I misunderstood what you are saying.  Are you refering to using the physical turret motion to create bullet patterns?  Sounds cool.  The progear turret tutorial was only meant to show how to use polar coords and I threw in the perspective thing as a bonus since they both fit together nicely when talking about turrets.  It wasn't supposed to be a tutorial on creating bullet patterns, but indeed there's no reason why you cant use any method you want to control the turret angle for creating nice patterns and represent this visualy using the technique I describe.
« Last Edit: February 12, 2007, 04:58:17 pm by motorherp »
Offline  
Read May 13, 2007, 12:31:49 pm #3
Five Damned Dollarz

Re: Control Schemes [part 1] : Progear turrets

I use Gamemaker and I am puzzled as to what the fapsf(); (?) function can translate into.
Its not a function for Gamemaker 6.1 (Which I use because GM7's EULA is too strict) and I am interested as to how I could make this effect in GM, any help is appreciated.
Thanks
Offline  
Read May 13, 2007, 12:48:30 pm #4
motorherp

Re: Control Schemes [part 1] : Progear turrets

fabsf is a function of the standard maths library, I'd be supprised if Gamemaker didn't include something equivalent.  The name stands for 'float absolute float', since its a function which takes a floating point number as input and returns a floating point number which is the absolute of the input.  To write this yourself it would look like:

float fabsf(float in)
{
   if(in < 0.0f)   { return -in; }
   else             { return in; }
}
Offline  
Read May 13, 2007, 01:00:43 pm #5
Five Damned Dollarz

Re: Control Schemes [part 1] : Progear turrets

In my opinion that seems somewhat pointless, I mean it checks if the number is less then 0 then makes it negative (which it already is), I assume that is what it does, and if it's larger then 0 it makes it a positive number (which it already is), if my assumption is wrong please tell me (I'm still in year 8 )
« Last Edit: May 13, 2007, 01:07:09 pm by Five Damned Dollarz »
Offline  
Read May 13, 2007, 01:03:59 pm #6
motorherp

Re: Control Schemes [part 1] : Progear turrets

Not quite.  If the input is negative it returns the negative of the input.  Therefore if the input is -2.0f, what is returned is -(-2.0f) = +2.0f.  Therefore what is returned is always the absolute of the input.
Offline  
Read May 13, 2007, 01:04:55 pm #7
Five Damned Dollarz

Re: Control Schemes [part 1] : Progear turrets

So then its an inverse?
Also I just checked GM's help file, its doesn't have a function for it. I guess I'll just write a script then.
« Last Edit: May 13, 2007, 01:07:56 pm by Five Damned Dollarz »
Offline  
Read May 13, 2007, 01:09:16 pm #8
motorherp

Re: Control Schemes [part 1] : Progear turrets

No since if the input is positive a positive value is returned.  It is the absolute, ie the magnitude, of the input which is calculated which is always positive.

Example

In = -2.0f
Out = -(-2.0f) = +2.0f

In = +2.0f
Out = +(+2.0f) = +2.0f

If you are struggling with the algebra of multiple signs I recommend reading http://www.algebrahelp.com/lessons/simplifying/multiplesigns/
Offline  
Read May 13, 2007, 01:12:07 pm #9
Five Damned Dollarz

Re: Control Schemes [part 1] : Progear turrets

I'm not very good at math, I'll have a read now, but thanks, that answers my question fairly well Smiley
After reading I understand it now, haha, thanks Smiley Now I might do better in math class.
Ah, now I understand it, I found the function, its called abs();  Roll Eyes
« Last Edit: May 13, 2007, 01:20:21 pm by Five Damned Dollarz »
Offline  
Read May 13, 2007, 01:21:39 pm #10
motorherp

Re: Control Schemes [part 1] : Progear turrets

No worries, I'm glad I can help.  Year 8 ..... so that would make you 12 or 13 year old?  Its impressive to see you take such an interest and show the willingness to learn more advance concepts.  I've just had a look at the curriculum for year 8 mathematics:

-Mathematical Diagrams
-Factors
-Pythagoras Theorem
-Rounding and Estimating
-Data Analysis
-Nets and Surface Area
-Ratio and Proportion
-Brackets

A lot if this stuff you'll find useful in games development and should help you understand the ProGear tutorial, in particular Pythagoras Theorem which you'll find useful time and time again.  If you ever need any help with this stuff or encounter any maths you need which you've not yet covered in school then please dont hesitate to contact me and ask for help.  Good luck
Offline  
Read May 13, 2007, 01:24:33 pm #11
Five Damned Dollarz

Re: Control Schemes [part 1] : Progear turrets

I am turning 14 in 2 months Tongue I am Australian too, which makes our curriculum's different I should think.
Thanks for the luck, I'll need it Tongue
Actually, on further comparison, it's about that same, my mistake.
« Last Edit: May 13, 2007, 01:31:28 pm by Five Damned Dollarz »
Offline  
Pages: [1]   Go Up
Jump to:  

Page created in 0.123 seconds with 19 queries.