SubMarine!

Use this forum to share and discuss Uzebox games and demos.
User avatar
Kilo
Posts: 330
Joined: Wed Dec 19, 2012 3:43 pm
Location: AC, Germany

SubMarine!

Post by Kilo »

Hey guys,

here's my first try in C ever...
well, the time feature isn't already finshed and the animation of enemy destroying!
But I want to try if I can make a kind of submarine game where you can fire on enemies and score up in a given time!
However, the graphic is done by me, selfmade painting in only 10 minutes... :lol:
The code isn't really nice to read and there are many bugs and features which will finished in future!

Would be nice to get some help and hints!
submarine.uze
Final release
(42.36 KiB) Downloaded 519 times
Submarine.hex
Final release
(117.76 KiB) Downloaded 521 times
Sub2.jpg
Sub2.jpg (32.92 KiB) Viewed 9109 times
Previous versions:
Attachments
submarine(wip).uze
(42.22 KiB) Downloaded 434 times
SubMarine(WIP).hex
(117.36 KiB) Downloaded 411 times
Last edited by Kilo on Thu Jan 17, 2013 5:08 pm, edited 1 time in total.
The last digit of Pi is 7! I calculated this, as I counted to infinity yesterday!
User avatar
Roukan
Posts: 113
Joined: Sat Oct 27, 2012 7:50 pm
Location: Lancashire / England

Re: WIP: SubMarine

Post by Roukan »

Kilo wrote:Hey guys,

here's my first try in C ever...
well, the time feature isn't already finshed and the animation of enemy destroying!
But I want to try if I can make a kind of submarine game where you can fire on enemies and score up in a given time!
However, the graphic is done by me, selfmade painting in only 10 minutes... :lol:
The code isn't really nice to read and there are many bugs and features which will finished in future!

Would be nice to get some help and hints!
Hi Kilo

Nice to see another project on the horizon.

Graphics look very nice especially for only 10 minutes work :)

I'm still only a novice myself, but if I can help in any way I will try to answer.

Look forward to your progress on this project.


Cheers

Roukan / Jim
User avatar
Janka
Posts: 214
Joined: Fri Sep 21, 2012 10:46 pm
Location: inside Out

Re: WIP: SubMarine

Post by Janka »

Ah, the good ol' submarine! I remember playing for hours to hit the small, fast boats.
User avatar
Kilo
Posts: 330
Joined: Wed Dec 19, 2012 3:43 pm
Location: AC, Germany

Re: WIP: SubMarine

Post by Kilo »

thanks! :D

Ok... now there are more features:

- time gets up 15 sec. if a ship is hit
- score is count up
- animation if ship is hit

*the attachments are updated!!!!

WHAT I NEED:
- how to randomize a number in order to get different heights for the enemy to appear?? in basic it's: a=rnd(10)+5 (a is between 5 and 15)
Last edited by Kilo on Fri Jan 18, 2013 5:13 pm, edited 1 time in total.
The last digit of Pi is 7! I calculated this, as I counted to infinity yesterday!
User avatar
Harty123
Posts: 467
Joined: Wed Jan 12, 2011 9:30 pm
Location: PM, Germany
Contact:

Re: WIP: SubMarine

Post by Harty123 »

this looks awesome for only 10min ??? work! I'm curious about the finished game...
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: WIP: SubMarine

Post by uze6666 »

Hehe the classic submarine game...looks great! I'll give it a spin tonight for sure.
User avatar
Roukan
Posts: 113
Joined: Sat Oct 27, 2012 7:50 pm
Location: Lancashire / England

Re: WIP: SubMarine

Post by Roukan »

Kilo wrote:thanks! :D

Ok... now there are more features:

- time gets up 15 sec. if a shit is hit
- score is count up
- animation if ship is hit

*the attachments are updated!!!!

WHAT I NEED:
- how to randomize a number in order to get different heights for the enemy to appear?? in basic it's: a=rnd(10)+5 (a is between 5 and 15)
Hi Kilo

There is a pseudo random number routine in the Space Invaders source code.

Code: Select all

u8 prng; // Pseudo-random number generator declared as a file level variable
// -----------------------------------------------------
#define MAX(x,y) ((x)>(y) ? (x) : (y))
#define PRNG_NEXT() (prng = ((u8)((prng>>1) | ((prng^(prng>>2)^(prng>>3)^(prng>>4))<<7)))) // Utility macros
//------------------------------------------------------
++prng;
prng = MAX(prng,1); // This piece code should be placed in you title screen loop whilst waiting for a button press.
// -----------------------------------------------------
varname = (PRNG_NEXT()%11) + 5; // returns a value between 0 and 10 so you can add to this to get your range (+5 gives a range of 5 - 15)
Hope this helps.


Cheers

Roukan / Jim
User avatar
Kilo
Posts: 330
Joined: Wed Dec 19, 2012 3:43 pm
Location: AC, Germany

Re: WIP: SubMarine

Post by Kilo »

Hey Roukan,

thx, this would help!! I have to test it! ;)

Well, the graphics and the code were done in 10-20 min.
So lucky that there's an emulator to test always the code :lol:
Because it was more trial and error!!

But I think the result of the game would be worth to publish it :)
I'm working on it guys!

PLEASE give me feedback when you testedt the game!!!
The last digit of Pi is 7! I calculated this, as I counted to infinity yesterday!
User avatar
uze6666
Site Admin
Posts: 4801
Joined: Tue Aug 12, 2008 9:13 pm
Location: Montreal, Canada
Contact:

Re: WIP: SubMarine

Post by uze6666 »

Just gave it a test, all I can say is great start! Here's a couple comments/ideas for when you get more comfortable with the programming side. You probably considered all that already, but here it goes.
  • Have the boat and sub graphic flip horizontally to follow the moving direction
  • Vary the screen side and height where the sub appears. Vary the moving speed too.
  • The sub can throw torpedoes too in straight line. Some of them, randomly, could be homing torpedoes perhaps moving more slowly so the boat can have a chance to counter.
  • Have levels where things get harder with more subs at the same time. The sub could vary direction randomly mid-screen. Why not have attacking planes at the same time! They could throw bombs or parachute mines.
  • Have bonus things to shoot to increase the timer.
  • Use video mode 3 and sprites. This will allow smooth animations. Plus you can use the sprite X-flip feature to save on flash.
User avatar
Kilo
Posts: 330
Joined: Wed Dec 19, 2012 3:43 pm
Location: AC, Germany

Re: WIP: SubMarine

Post by Kilo »

Hi Uze,

thank you!!!
Yes, I will implemant this all!

Well, the graphics.... hm...because I'm new to C, I wrote the code on the video mode based on megatris!
So I don't know how to change the mode and program with sprites... but let me try!
for beginning I will take this version in order to try! Later on I will make a new version!
The last digit of Pi is 7! I calculated this, as I counted to infinity yesterday!
Post Reply