Page 1 of 3

S-COPTER, a Choplifter - Like

PostPosted: Sat Jan 03, 2015 5:50 pm
by clement
Hi,

I ve commit lastest change of S-COPTER

Image


The code is on GitHub : https://github.com/Clement83/Copter


enjoy :)


----- last post ---
Hello,

I begin a choplifter-like

some screen-shot :

Image
Image

The code is on GitHub : https://github.com/Clement83/Copter

enjoy :)

Re: Choplifter - Like

PostPosted: Sat Jan 03, 2015 8:17 pm
by honolulu
Excellent !!

Great Idea !! Love this game.

Re: Choplifter - Like

PostPosted: Sun Jan 18, 2015 10:34 pm
by clement
I change the style of game !

Now is modern warface choplifter ;)

Image

Re: Choplifter - Like

PostPosted: Mon Jan 19, 2015 10:22 am
by frakasss
Looks great!! :)

Would be good to have the 'landscape' in grey instead of black?
Else, it will be difficult to differentiate 'obstacles' and 'landscape', don't you think so?

Re: Choplifter - Like

PostPosted: Mon Jan 19, 2015 8:45 pm
by jonnection
Looks awesome! Choplifter is one of my all time favourite games.

2 ideas for you:

1) in your drawBitmapAngle, you are calculating sin(angle) and cos(angle) in every loop of your bitmap code (inside the for (i = 0; i < w; i++) { loop)

You can calculate the sin(angle) and cos(angle) only once at the beginning of the routine and store them in variables (calculer seulement une fois au debut de la routine). Then you can use those values inside the loop. That way you can save a lot of processor cycles.

2) draw another helicopter bitmap where you have the whole helicopter including windows in black (tous pixels noire, et aussi les fenetres)

then you can change the bitmap code to:

void drawBitmapAngle(int8_t x, int8_t y, const uint8_t *bitmap, const uint8_t *mask, float angle)
...
// read from mask if pixel should be drawn
if (pgm_read_byte(mask + j * byteWidth + i / 8) & (B10000000 >> (i % 8))) {
// determine colour of pixel from bitmap (black = body of chopper, white = window)
gb.display.setColor(pgm_read_byte(bitmap + j * byteWidth + i / 8) & (B10000000 >> (i % 8))); // ... or something like this
gb.display.drawPixel(x + desX, y + desY);

In this way, you can have a masked bitmap of your chopper == it will stand out from the background !

Happy coding !

Re: Choplifter - Like

PostPosted: Tue Jan 20, 2015 6:51 pm
by clement
Thank for your Advice frakasss and jonnection. :D

Re: Choplifter - Like

PostPosted: Sat Jan 31, 2015 8:03 pm
by clement
Hi,

I'v work on the game :

Image

Change log :
  • Core game optimisation (thank jon)
  • Take prisoner in chopper
  • Save it on base camp
  • Kill ennemies, and prisoner
  • Ennemies can kill you
  • new ennemie


I'v update Git hub repository, in the .zip you can get the S-COPTER.HEX for test it : https://github.com/Clement83/Copter

todo :
  • IA
  • Start/win/die screen
  • Rocket luncher
  • Prisoners are in jail and you need to break it to save them
  • improved graphics and readability
  • OverCharge getline
  • chopper Life in HUD

Re: S-COPTER, a Choplifter - Like

PostPosted: Wed Apr 08, 2015 7:27 pm
by clement
last update :

change log :

  • die screen
  • improved graphics and readability
  • OverCharge getline
  • chopper Life in HUD
  • the game is more difficult
  • restore life COD 'style
todo :
  • IA
  • Start/win
  • Rocket luncher
  • Prisoners are in jail and you need to break it to save them

Re: S-COPTER, a Choplifter - Like

PostPosted: Wed Apr 08, 2015 8:16 pm
by jonnection
Starting to look very nice Clement !

I also checked out your code for drawing the helicopter. It is much better optimized now, and looks better too.

One more thing:

you can replace the modulus operator (%) with a bitwise modulo in line

Code: Select all
if (pgm_read_byte(mask + j * byteWidth + i / 8) & (B10000000 >> (i % 8)))


Because in powers of 2, i%8 is the same thing as i&7. So you can write it as:

Code: Select all
if (pgm_read_byte(mask + j * byteWidth + i / 8) & (B10000000 >> (i & 7)))


http://stackoverflow.com/questions/3072665/bitwise-and-in-place-of-modulus-operator

Bitwise modulo is should be faster than the modulus operator (%), although mayber the compiler optimizes correctly.

Also, in powers of 2, division by numbers that are 2^n can be replaced by bitshifts, so:

i / 8

is the same as

i>>3

Again, it might be that the compiler does this correctly, but it is fun to know about these small tricks !

Keep on coding, looking good !

Re: S-COPTER, a Choplifter - Like

PostPosted: Mon Apr 13, 2015 6:20 pm
by clement
thx for your advice jonne!

I change it in the future version.