Log In  

Cart #55874 | 2018-08-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

Years ago back in DOS, I remember playing one or two games by this author who had a unique idea. That is, to make every item on the screen have its own identity.

It was pretty simple. He used a 320x200 screen with 16-colors and made these little 8x8 images in a platformer. Despite not having the source code to it, (it was a .COM game) I could tell at once that the enemies spawned and shots and other hazards moved on a tight grid.

That is, you could follow a shot and if you went faster than it where it scrolled off the screen, it vanished. Same thing the other way.

I finally gave a name to this unusual method calling it COMPONENT tiles. That is, every tile definition had its own program to run.

What I have done here is quite similar though it is still a fairly intelligent engine.

It is the classic Space Invaders, you can move left and right, (O) to fire, but you can hold the (X) button down and "glitch" it by adding random components on the screen, including extra player tanks, extra invaders, more saucer launchers, even random fire.

All values are accepted. So it is indeed possible to have multiple tanks on the screen, all controlled by you, and add Invaders where they must all still follow the rule of going down a step with each left- or right-most invader being on the edge of the play field.

It is also self-contained in a single string converted to an array so you can design your own:

play=[[
--------------------------------
------------------------------2-
--------------------------------
------------4-4-4-4-4-4-4-4-----
--------------------------------
------------4-4-4-4-4-4-4-4-----
--------------------------------
------------4-4-4-4-4-4-4-4-----
--------------------------------
--------------------------------
--------------------------------
--------------------------------
----11111----11111----11111-----
----11111----11111----11111-----
----1---1----1---1----1---1-----
--------------------------------
----------6---------------------
--------------------------------
]]

Also, I'm sure to everyone's delight, I =AM= making use of proper functions, _INIT(), UPDATE(), and DRAW(). Better enjoy it, this may be the only program I write conventionally this way. :)

Actually for this kind of program where everything runs at once, UPDATE() and DRAW() were quite the perfect thing to use.

I can see the UPDATE() and DRAW() might be useful if I add a DEMO to the games I write, as then I can call DRAW() automatically and draw the game components yet still leave it in demo mode where the computer controls the player until the game is actually started.

Lots to think about. Maybe I misjudged Update(), and Draw(). Will give it some thought.
Hope you enjoy this !

P#55875 2018-08-29 23:09 ( Edited 2018-08-30 03:09)


[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 10:28:40 | 0.008s | Q:10