Hi everyone,
I'm writting old "Battle ship" game. I know, that is very funny, but I want my own version, with one objects and inheretancy levels.
Here is a plan what I'm reaching for:
----------------------------
object:
A-level:
- aship - keeps common parameters of floating things
B-level
- ship - can move not depending on wind
- mine - fixed and can explode
- yacht - can move depending on wind
C-level- torpedo - derived from ship and mine, thus can move not depending onwind and can explode
constructors of ship, mine, yacht and torpedo classes must set ashipproperties (moveable or fixed, can explode and is it wind-dependant ship)
globally I must set wind and it direction.
movement:
an object:
if object.canmove {
if object.needswind {object.setwind(w,a)}
object.goahead(1) }
- if it is a ship or torpedo - it must change x and y depending onspeed and time, if it is mine - it will be skipped, if it is yacht -wind parameters set then x and y will be changed depending on wind andangle and on is sail up or down (if down - yacht stay fixed) meeting:if two or more objects have same (rounded) coordinates - if any mayexplode - explosion, otherwise - just wreck.
--------------------------
Some program steps I done. Movement test of "torpedo" is completed, but I messed up with finishing.
Need to done meeting of objects and other complex thing, wich I can't to find as a result.
By the way I'm using "Borland C++ Builder 5.02" for my project - if nessecary to know.
Please, someone look in my situation and try to help me.
I attached my work in zip.
Thanks in advance.
Egsonas