• entries
271
• comments
969
• views
189165

# Flippy!

191 views

Hey everyone!

I've got a semi-screeny-ful entry tonight, so read on and be amazed (hopefully[wink])

Double Tap Controls
This is a pretty neat addition to the game, and it adds a bit more depth and ability to the player in maneuvering their plane. Essentially, if you double tap an arrow key, the airplane will do something special depending on what arrow you tapped. For example, if you double tap up, your afterburner lights up and you accelerate like crazy for as long as you hold the button, but you can't turn as fast, so running into the ground is really easy. Double tapping the down button is your speed brake, which slows your plane down very quickly. The left and right arrows have probably the coolest function, as double tapping them will perform an thrust vectored 180 degree flip, so you end up pointing the opposite direction. It looks freaking awesome, and is actually useful in combat (especially agaisnt enemy fighters that are chasing you). Anyways, in the screeny below I'm performing one of the 180 flips, note the cool vapor trails....

Speed Streaks
This is a pretty useless feature I added, but it looks cool, so I think it's going to stay. It pretty much consists of some lines that come flying across the screen when you are hauling ass in afterburner. They wizz by and make you feel like you're going really fast, but thats about it, here's a screeny of me streaking towards the heavens (minus the afterburner effect)

More on the bug
So I searched through the rest of my code like everyone suggested last entry, and I did find a globally declared "tempangle", which is also odd because the compiler never bitched at me for trying to declare it again in that function. Anyways, that bug has yet to resurface, so I'm going to assume that it was just one of those odd things that makes no sense.....

Well, thats all for now, Peace Out!

## Recommended Comments

"which is also odd because the compiler never bitched at me for trying to declare it again in that function."

It's valid to declare a more local variable of the same name.

#include<iostream>

using namespace std;

int i = 10;

void foo();

void main(){
cout<<i<<std::endl;
foo();
}

void foo(){
int i = 20;
{
int i = 30;
for(int i = 40;i<41;++i){
cout<<i<<std::endl;
}
cout<<i<<std::endl;
}
cout<<i<<std::endl;
}


Expected output:
10
40
30
20

This sort of example (less elaborate) is found in "The C++ Programming Language" Special Edition, not sure of the other editions, but excepted.

I take it the after burner effect is a trailing flare/smoke?
Another idea for the afterburner (call it another useless effect) a "v" looking effect just before (or just after) the tip of the nose. Or maybe make it a less useless effect, by making it cause a slight deflection effect on bullets and other projectiles (very slight, so bullets would still hit, but it makes a nice effect).

#### Share this comment

##### Link to comment
As previously mentioned, it is perfectly legal to declare a local variable that has the same name as a global variable. The global variable will just become inaccessible via the usual name (I believe "shadowed" is the technical term). However, for the sake of completeness, I thought I'd mention that if you shadow a global variable you can still access it by doing ::<variable name>. You're probably pretty familiar with the scope operator, so what that does is probably fairly obvious. Just accesses the named variable in the global scope.

Not terribly useful to know, probably, but I thought I'd throw it into the pot.

A related concept to the speed lines that would be cool would be steam lines on the wingtips when you pull a violent maneuver or something like that. It would also be pretty sweet if the plane did a 360-degree roll when you doubletap the left and right keys. I can't tell if it already does that or not.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• 12
• 25
• 11
• 10
• 16