Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - combatking0

Pages: 1 [2] 3 4 5 6
21
Many of us may remember this classic from the 16-bit era, and I have recently started playing it again, but...

I have seen posts around the internets referring to a QBASIC password generator for this game. I've downloaded the generator, but what I'm interested in is the source code for it, as I can't find it anywhere.

Has anybody here downloaded this in the past? If so, please share it with me, as it would be interesting to port it to JavaScript.

Although, reverse engineering it would also be interesting.

22
Other languages / JavaScript - Sprite Object
« on: May 03, 2013 »
With the development of the Canvas element, I have started work on a Sprite template. The attachment includes the following files:

sprite.js - the template
StarBlast.htm - a very early version of a SHMUP I'm working on to demonstrate the features of the template

There are also some assorted image files which are used by StarBlast.htm, but these are not part of the template.

This version of sprite.js uses the following constructor:
spriteVar = new sprite("image_file_name",x,y,canvas);

image_file_name is the file name of the image which this sprite will use. GIF, JPG and PNG file types are supported.
x and y are the default position of the sprite on the canvas.
canvas is the reference of the canvas on which this sprite will appear.

Once constructed, the sprite object(s) have the following properties:
x - the horizontal position of the centre of the sprite.
y - the vertical position of the centre of the sprite.
xSpeed - the horizontal speed of the sprite in pixels. (Default = 0)
ySpeed - the vertical speed of the sprite in pixels. (Default = 0)
xScale - the horizontal scale of the sprite as a ratio. (Default = 1)
yScale - the vertical scale of the sprite as a ratio. (Default = 1)
renderX - the left edge of the sprite (Read Only)
renderY - the top edge of the sprite (Read Only)
imageW - the width of the sprite (Read Only)
imageH - the height of the sprite (Read Only)
bearing - the rotation of the sprite in radians. (Default = 0, Range -PI to PI)
alpha - the opacity of the sprite. (Default = 1, Range = 0-1)
canvas - the canvas reference on which the sprite will be drawn.
img - the Image object used to store the image file data.
img.src - the file name of the image.
imageLoaded - the state of the Image object, becomes TRUE if the image file has been loaded into memory.
imageError - the state of the Image object, becomes TRUE if the image file has failed to load into memory.

The sprite objects have the following methods:
setScale(sx,sy) - sets the horizontal (sx) and vertical (sy) scales of the sprite relative to the dimensions of the image file.
move() - updates the x and y properties by adding the xSpeed and ySpeed properties to them.
rotateD(angle) - updates the bearing property by adding the angle argument to it. **Note that the bearing property is stored as Radians, while the angle argument is specified in Degrees, and converted by this method - SLOW**
rotateR(angle) - updates the bearing property by adding the angle argument to it. **Note that this version uses Radians, which is more efficient than rotateD**
getBearing(x,y) - returns the angle of a point relative to the centre of the sprite. (0 is up, 0.5*PI is right, PI is down and -0.5*PI is left)
draw() - draws the sprite image to the canvas while applying rotation, transparency and scaling. **Note that this function will draw a small red square if the image has failed to load**

This template is under development, so please let me know if you feel changes should be made :)

The game itself has a graphical glitch during the explosion.
Use the arrow keys to move and the space bar to fire.

23
Other languages / AJAX - The Chat Demo
« on: April 29, 2013 »
A few people have been throwing around the idea of a PHP / JavaScript demo, and the first thing that popped into my head was the use of AJAX.

It is possible to hook the AJAX output into a canvas at the client side, and a database on the server side.

Users should then be able to post messages to the database (like a shout box) which are read back in real time into the canvas, which applies effects to the text, such as rendering it as cubes or some other inventive method.

I'll see how far I can run with this idea.

24
Other languages / Sudoku in Javascript
« on: March 17, 2013 »
I've revived an old project involving Sudoku.

In theory, it should be possible to fill a blank grid based on any square number. Traditional puzzles use 9 symbols, and I'm sure I've seen hexadecimal puzzles before.

My program will, when finished, generate puzzles using the following options:
9 Symbols - 1-9
16 Symbols - 0-9, A-F
25 Symbols - A-I, K-Z
36 Symbols - 0-9, A-Z

Using a simple brute-force technique, I can fill a blank 9x9 grid within a few seconds, but the other grids don't seem to resolve. Here's my code so far. Given time, I will annotate it so that you know what it does.
http://fx.barcodebattler.co.uk/Sudoku.htm

The next step, once it can complete a blank grid properly, will be to remove some of the squares and generate a solvable puzzle.

25
Projects / [Image Processing] - ASCII-inator
« on: February 05, 2013 »
Just for fun, I thought I'd try to build an image-to-ASCII-art converter in JS.

To use it, you'll need to unzip the archive, and place a GIF, JPG or PNG file in the same directory as the HTM file.
Next open the program under Firefox or IE9 and type the complete file-name of the image into the form.
Then press the Generate button. If the file-name is correct, the image should be converted into ASCII art.

It's only been successfully tested under Firefox and IE9. Chrome doesn't work due to a false-positive in its default security settings.

(edit) I have improved the code for better contrast handling, but only slightly.

Here's an output sample:
Code: [Select]
                               ¤xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx•                                     
                               ¤xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx•                                     
                               ¤xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx•                                     
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx·                 
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx·                 
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx·                 
                         NNNNNNNNNNNNNNNNNNX¤¤¤¤¤¤¤¤¤¤¤¤NMMMMMX¤¤¤¤¤•············                   
                         MMMMMMMMMMMMMMMMMMN••••••••••••NMMMMMX••••••                               
                         MMMMMMMMMMMMMMMMMMN••••••••••••NMMMMMX••••••                               
                  ·xxxxxxxxxxxxNMMMMMXxxxxxx••••••••••••NMMMMMX••••••............·                 
                  .MMMMMM••••••NMMMMMX••••••••••••••••••NMMMMMX••••••••••••••••••·                 
                  .MMMMMM••••••NMMMMMX••••••••••••••••••NMMMMMX••••••••••••••••••·                 
                  .MMMMMM••••••NMMMMMNxxxxxx••••••••••••xXXXXXXXXXXXx••••••••••••......·           
                  .MMMMMM••••••NMMMMMMMMMMMN••••••••••••••••••XMMMMMN••••••••••••••••••.           
                  .MMMMMM••••••NMMMMMMMMMMMN••••••••••••••••••XMMMMMN••••••••••••••••••.           
                  ·xxxxxxxxxxxxXXXXXXXXXXXXx••••••••••••xxxxxxNMMMMMMxxxxxxxxxxxx•.....·           
                         MMMMMM¤••••••••••••••••••••••••NMMMMMMMMMMMMMMMMMMMMMMMM.                 
                         MMMMMM¤••••••••••••••••••••••••NMMMMMMMMMMMMMMMMMMMMMMMM.                 
                         XXXXXX¤•••••¤•••••¤••••••••••••XNNNNNNNNNNNNXXXXXXXXXXXX.                 
                               ••••••••••••••••••••••••••••••••••••••                               
                               ••••••••••••••••••••••••••••••••••••••                               
                         ·     •¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤•     ·                         
                         xxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxx                         
                         xxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxx                         
                         xxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxx                         
                  ·xxxxxxxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxxxxxxx·                 
                  ·xxxxxxxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxxxxxxx·                 
                  ·xxxxxxxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxXXXXXXXxxxxxxxxxxxxxxxxxx·                 
            .xxxxxxxxxxxxxxxxxxxxxxxxXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxx.           
            •xxxxxxxxxxxxxxxxxxxxxxxxXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxx•           
            •xxxxxxxxxxxxxxxxxxxxxxxxXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxx•           
            .¤¤¤¤¤¤¤¤¤¤¤¤xxxxxxXXXXXXx¤¤¤¤¤¤XXXXXXXXXXXX¤¤¤¤¤¤xXXXXXXxxxxxx¤¤¤¤¤¤¤¤¤¤¤¤.           
            .••••••••••••xxxxxxXXXXXX¤•••••¤XXXXXXXXXXXX¤•••••¤XXXXXXxxxxxx••••••••••••.           
            .••••••••••••xxxxxxXXXXXX¤•••••¤XXXXXXXXXXXX¤•••••¤XXXXXXxxxxxx••••••••••••.           
            .•••••¤••••••¤¤¤¤¤¤xXXXXXxxxxxxxXXXXXXXXXXXXxxxxxxxXXXXXx¤¤¤¤¤¤••••••¤•••••.           
            .••••••••••••••••••xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx••••••••••••••••••.           
            .••••••••••••••••••xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx••••••••••••••••••.           
            .•••••¤••••••xxxxxxXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxx••••••¤•••••.           
            .••••••••••••XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX••••••••••••.           
            .••••••••••••XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX••••••••••••.           
            ·............XXXXXXXXXXXXXXXXXXx¤¤¤¤¤¤¤¤¤¤¤¤xXXXXXXXXXXXXXXXXXX............·           
                         XXXXXXXXXXXXXXXXXX¤            ¤XXXXXXXXXXXXXXXXXX                         
                         XXXXXXXXXXXXXXXXXX¤            ¤XXXXXXXXXXXXXXXXXX                         
                   ......XXXXXXXXXXXXx¤¤¤¤¤•            •¤¤¤¤¤xXXXXXXXXXXXX......                   
                  .MMMMMMMMMMMMMMMMMM¤                        ¤MMMMMMMMMMMMMMMMMM.                 
                  .MMMMMMMMMMMMMMMMMM¤                        ¤MMMMMMMMMMMMMMMMMM.                 
            ······•MMMMMMMMMMMMMMMMMM¤                        ¤MMMMMMMMMMMMMMMMMM•······           
            ¤MMMMMMMMMMMMMMMMMMMMMMMM¤                        ¤MMMMMMMMMMMMMMMMMMMMMMMM¤           
            ¤MMMMMMMMMMMMMMMMMMMMMMMM¤                        ¤MMMMMMMMMMMMMMMMMMMMMMMM¤           
            ¤MMMMMMMMMMMMMMMMMMMMMMMM¤                        ¤MMMMMMMMMMMMMMMMMMMMMMMM¤           

I may need to make some adjustments.

(edit) I've updated again - I should really do more testing before I release :)
Charset 10 is now the default, non-existent files are handled better, and you can now choose between 3 scaling options. Also, the courier font aspect ratio is better catered for.

26
Other languages / Old JavaScript Code
« on: January 29, 2013 »
Many, many years ago (6 or 7?) I created some games in JavaScript, and I've been looking back at them for code examples.

Most of the resources on my old "After School Programmers" site are out dated, but there are a couple of challenging games on there for IE only. If I get time I'll update them for all browsers.

The games are on http://asp2.barcodebattler.co.uk/MyGames/index.php and are accessable from a drop down menu with "Pie Rats of the Caribbean" as the default option. The best ones are Mole Mash and Lone Invader.

27
Other languages / The quirks of PHP - mktime
« on: January 19, 2013 »
I've been trying to perfect my PHP Catholic Calendar Generator, and found some odd behaviour in the mktime function - if the timezone is not specified, it will try to guess when to apply BST or DST, messing up the date comparison operations which need to be exact in a script like this - so I defined the timezone as UCT, which is not affected by BST or DST.

On a side note, the Catholic Calendar has more rules than a game of Yu Gi Oh, which makes for an interesting coding challenge.

On another side, maybe we could put together some sort of Demo Scene Calendar for 2014, featuring screen shots of some of our finest effects and demos from previous years. Just an idea.

28
Other languages / [JS] JavaScript Canvas Experiments
« on: January 14, 2013 »
After learning a few new tricks in the UDG challenge, I have resolved to attempt the following:

1. Rotate an image and draw it onto a canvas.
2. Copy a triangular / rectangular section of an image and draw it onto a canvas.
3. Distort a triangular / rectangular section of an image and draw it onto a canvas.
4. Texture mapping.

Gourad filling is also well documented.

29
Just a quick one - it took me a few days, but I think this meets the criteria.

Hopefully you will enjoy this one, and it may inspire those who have yet to decide how to present their UDG entries.

View online version (music may not kick in until it has buffered)
Download (music starts instantly)
 :bully: :bred:
Requires IE9+ or a recent version of FireFox or Chrome, or any HTML5 compliant browser.

30
General chat / R.I.P. Patrick Moore
« on: December 09, 2012 »
One of the few famous people I respect has passed away. He was an inspiration to generations of amateur astronomers and people who were generally curious about science.

Even at age 89 he was still making "The Sky at Night", and I'll always remember his work on "Gamesmaster" as a complementary performance which demonstrated that was more than just a one-trick astronomer.

Take a well-earned rest Patrick.

31
Challenges & Competitions / [SPOOKY] Creepy Cubes v1.2
« on: October 26, 2012 »
I present my entry to the 2012 Halloween competition - Creepy Cubes!

It's so low-res that I couldn't fit a scroller onto it, so details and greetings are in the readme file.

I hope you enjoy it. Please run it in a recent version of FireFox, Chrome, Opera or Safari.

Can you recognise all 8 images? You may want to stand well back from your monitor.

(edit) - patched a FireFox bug in which the music failed to loop.

(edit 2) - added a scroller and a z-depth wave which I wanted to add the first time round, but feared I would run out of time to to family issues which have since been resolved faster than expected. The scroller is so low res that I have left the scroller message in the ReadMe.txt file if you want to read it faster.

You may want to press F11 to run this demo in full screen mode.

32
I've been contemplating switching back to HTML, CSS and JS so that I can code apps for Windows 8.

There's been a lot of talk on the internets about how dumbed down the new interface is. I've tried out one of the preview releases, and it feels like I'm using a V-Tech toy.

But, if that's where the future is, then I can try coding for it, and possibly resurrect some of my iPhone ideas which were dropped because I had to hand the dev-kit back to it's owner before I could learn the language.

Does anybody else have plans for Win8 coding?

33
C / C++ /C# / [C#][OpenTK] 3D Rotation
« on: July 25, 2012 »
I've been looking at the OpenTK documentation for rotating a 3D model, but I'm having difficulty in understanding it.

Whenever GL.Rotate is called in the examples, it appears to apply to the whole environment, rather than an individual point in the object I'm drawing.

This could cause problems when I want to draw 2 seperate 3D objects, rotating independantly.

Or should I apply the rotation, draw the first object, then apply another rotation, and draw the second object?

I'll give it a try.

34
Recently, I've been learning how to combine C# and OpenGL, using SharpDevelop and OpenTK.

But I keep forgetting how to do it, so I've started taking some notes:
Part 1: http://barcodebattler.co.uk/tutorials/
Part 2: http://barcodebattler.co.uk/tutorials/csgl2.htm
Part 3: http://barcodebattler.co.uk/tutorials/csgl3.htm (Under construction)
Part 4: (Coming soon)
Part 5: (Coming soon)

Hopefully these should help others to get started too.

35
C / C++ /C# / C# + OpenTK - Planning a Tutorial
« on: July 02, 2012 »
I'm planning a beginners' guide to C# and OpenTK. Here's what I have planned so far:

Requirements:
Install Sharp Develop
Install OpenTK

Part 1: Basic Set-up
Create new project
Link to OpenTK dll
Link to OpenTK Control dll

Part 2: Prepare for Graphics
Add GLControl to MainForm
Check for loading
Set up viewpoint (FOV)

Part 3: First Steps
Set up timer (frame rate)
Define corners and faces
Draw to GLControl (Wireframe)

Part 4: Spin it Right Round
**Research GL rotation**
Draw to GLControl (Polygons)
Back Face Culling

Part 5: Move Towards the Light
Add keyboard controls
Add Texture Mapping
Add Light Sourcing

I'll try to put together one part each day for the next week or so.
I've been using the quaternion functions I worked on for Actionscript for rotation, but I've heard that there are native quaternion functions in OpenGL / OpenTK, so Part 4 could be delayed while I learn about them.

Any suggestions as to what to add, and I'll try to put them in.

36
General chat / Logic Gates
« on: June 22, 2012 »
With recent changes to the way computing is going to be taught to pupils in the UK, I've been asked to produce various resources for the new curriculum.

Here's one I've just finished - it's a logic gate simulator of sorts, including interactive inputs, truth tables and simplified CMOS circuit diagrams.

The XOR and XNOR gates were a pain in the ass, but I think they're accurate now.

(edit)

I've just noticed an error on the XOR gate when the inputs are both high - I'll fix it tonight.

(edit 2) Fixed - it should be fully accurate now.

(edit 3) Changed "Output O" to "Output Q" to avoid confusion between "0" and "O" after user feedback.

(edit 4) Changed "O" to "Q" in the truth tables too - that should fix it.

37
I have completed my first C# program - an updated version of Zero Encrypter, which encompasses all of my C# skills to date.

Since then, I have been researching the graphical functions of C#, but I cannot even figure out how to make it draw a line, for example:

Yabasic - line(x1,y1, x2,y2)
ActionScript - moveTo(x1,y1); lineTo(x2,y2);

There also seem to be many implementations of OpenGL for C# - if C# does not support graphical functions natively, which implementation of OpenGL would you suggest is best to use in terms of portability? So far, I have found OpenTK and Tao API. Are there any standard ones?

Or should I switch to C++ until C# is officially supported by the OpenGL group?

38
After many years of being a member here, I have finally produced my first tutorial.

Many languages come with Quaternion functions built in. This tutorial has been made for the benefit of those who are coding in languages without Quaternion capabilities.

The Yabasic version is a bit sloppy, but runs smoother than the Actionscript version. Even if you don't have Flash, you can still view the ActionScript code using Notepad++ or Notepad by looking in the .as files.

You'll need Jim's Yabasic Emulator to edit or run the Yabasic version, or Flash 8 or higher to edit & recompile the AS version Flash Player 8 or higher to veiw the AS version.

39
Challenges & Competitions / [CUBES] Runtime
« on: May 11, 2012 »
OK, this is definitely my final entry for this competition.

The music is "Wobblyglad" by Clusterfrog.

Cubot is going to be thoroughly re-programmed for his naughty behaviour.

(edit) I have re-uploaded this due to an error in the original upload which invalidated the zip file.

(edit 2) I am now hosting the swf and the exe as downloadables:

<a href="http://barcodebattler.co.uk/d/Runtime.swf" target="_blank" class="new_win">http://barcodebattler.co.uk/d/Runtime.swf</a>

http://barcodebattler.co.uk/d/Runtime.exe


40
Challenges & Competitions / [CUBES] Coders' Block
« on: April 28, 2012 »
Here's my second entry - hopefully it will reverse the trend, and be better than my first entry (as my second entries are usually rushed).

It's based on several Yabasic tutorials.

Pages: 1 [2] 3 4 5 6