Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:15 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2 - Tank versus UFO

Author Message
Schlowski
Newbie

Joined: 26/03/2014
Location: Germany
Posts: 29
Posted: 03:45pm 15 Feb 2021
Copy link to clipboard 
Print this post

As a snake clone already exists I took the chance to make a conversion of the classic Tank versus UFO from the VIC-20 user manual.

As the CMM2 is a little bit more powerful than the good old VIC it should be called Tank versus UFOs.

I tried to auto-detect Nunchuks and Classic controllers in ports 1 to 3, support the digital joystick with the following pins as in the CMM2 deluxe
const DUP = 35
const DDOWN = 36
const DLEFT = 38
const DRIGHT = 40
const DFIRE = 32

Any button on the digital or classic controller or nunchuk including shoulder buttons and select, home or start act as fire buttons.
Any directional control, analog or digital can be used to move your tank left or right.

Of course it's possible to play with keyboard, use cursor keys to move and space to fire.

There's no sound as I'm worse in sound compared to graphics :-)
Or positively spoken it's only a single .bas file with no additional files and can be started from anywhere.





TankVersusUFO.zip
 
Plasmamac

Guru

Joined: 31/01/2019
Location: Germany
Posts: 579
Posted: 04:33pm 15 Feb 2021
Copy link to clipboard 
Print this post

Hahaha Asci ! Genial
Plasma
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 06:39pm 15 Feb 2021
Copy link to clipboard 
Print this post

Awesome! Well done!
Visit Vegipete's *Mite Library for cool programs.
 
Schlowski
Newbie

Joined: 26/03/2014
Location: Germany
Posts: 29
Posted: 07:49pm 15 Feb 2021
Copy link to clipboard 
Print this post

Thank you :-)
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 08:31am 16 Feb 2021
Copy link to clipboard 
Print this post

New challenge: change it into dual player. One plays the WASD keys, the other the arrow keys. Two tanks versus UFO's...
PicomiteVGA PETSCII ROBOTS
 
Schlowski
Newbie

Joined: 26/03/2014
Location: Germany
Posts: 29
Posted: 09:03pm 16 Feb 2021
Copy link to clipboard 
Print this post

Challenge accepted!

Here you go, Multiplayer Tanks vs. UFOs, up to 4 players.

Freely configurable user inputs, multiple keyboard controls possible:


Multiplayer arcade action for your home:


If you switch the colors in the configuration to all players white the confusion is perfect :-)

Hopefully not too many bugs, it's really difficult to test a multiplayer game as a single developer!

TanksVersusUFOs.zip
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 10:47am 17 Feb 2021
Copy link to clipboard 
Print this post

Schlowski, Kudos for your accomplished challenge. The result was beyond expected, very good!!
 
Schlowski
Newbie

Joined: 26/03/2014
Location: Germany
Posts: 29
Posted: 11:18am 17 Feb 2021
Copy link to clipboard 
Print this post

Thank you, I have tons of fun tinkering around with my new toy.

MMBasic is a very cool tool with it's SUBs and local variables and so on. Only thing I'm really missing are structs or records, for TvU I went on using a lot of Arrays.

tx() for tank x-coordinates
ty() for tank y-coordinates
tl() for tank lives

ux() for UFO x-coordinates
uy() for UFO y-coordinates
etc.

It's very readable but makes the code a little bit convoluted...

For more complex structures I'm thinking of using strings as binary blobs and packing and repacking data in and out of strings. I'm sure this needs some thorough testing for speed and function.
Maybe that would be something for CSUBs, but I'm anxious to loose control over when to use BASIC and when to use CSUBs as you could do everything in a CSUB.

So many new frontiers...
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 11:33am 17 Feb 2021
Copy link to clipboard 
Print this post

With the limitation of 3 types in MMBasic, I'm using more ways how to replace missing types:
1. STRINGS (and STRING arrays), for example when use DIM STRING x(100) LENGTH 2 and STR2BIN(), BIN2STR$() with UINT16, it takes less memory than INTEGER. You can also pack more variables in one STRING
2. LONGSTRING or binary data with PEEK/POKE
3. more dimensions for ARRAYs, DIM INTEGER coord(n,2), where coord(n,0) is X...

Just my few cents...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025