Title: Curved Text & RLE vector routines (part 2)
| Code Submitted By: - andy_a
| This code snippet will run as is, but you'll need part 1 for creating and saving images in your own program. The new functions are:
makeData() - makes a text file of data statements that can be copy & pasted into your source code.
getImgData() - once you've pasted the data statements into your source, use this function to load into memory for further processing.
data2buffer() - like the above, but will re-create the image at 0, 90, 180, 270 degrees (user specified) in a Blitz image buffer. Use the Blitz image buffer just like you would use any loaded external image file.
dat2curv2buf() - reads the image in the data statements, wraps the image around a curve, and stores in a Blitz image buffer.
Simple usage demo included. |
|
|
|
|
Title: 2 line FPS code
| Code Submitted By: - andreas_blixt
 | This code has now been updated to be much more accurate and it still uses 2 lines! To get the current FPS, just use CurFPS#. |
|
|
Title: A function to get a token of a string
| Code Submitted By: - kameleon
 | I made this function similar to the javascript split function. Lets you get a particular token (section) of a string by providing String,Deliminator,Token # |
|
|
Title: Array iteration techniques
| Code Submitted By: - thechange
| Demonstrating iteration/looping through a 1 and 2 dimensional array using 1 or 2 loops starting from either 0 or 1. |
|
|
Title: Asteroids Physics Library
| Code Submitted By: - darkeagle
| this is an EXTREMELY nice lib for lots of things... space games, hovercraft games, etc. basically anything that you want to have asteroids type ship control in :) just remember who gave it to ya ;) |
|
|
Title: Base 64 encoding and decoding functions
| Code Submitted By: - andy_a
| Best use for these functions are for encoding binary files into text which is then included as an e-mail attachment. Could also be used to create a "Post-It" like program in Blitz. Thanks go to Mangus for allowing me to post his encoding function here on Blitz Coder web site. |
|
|
|
|
Title: Clipping using maths
| Code Submitted By: - thechange
| Demonstrating clipping values using maths only. |
|
|
Title: Comma separated value
| Code Submitted By: - thechange
 | Add a comma every 3 characters to increase readability: 123,456,789. |
|
|
Title: Cyclical Redundancy Check - Two versions of CRC16
| Code Submitted By: - andy_a
| CRC's ensure that data is not corrupted during transmission. Whether loading a file from disk or transferring via modem CRC's ensure data integrity.
Found a QBasic listing (author unknown) here: www.fys.ruu.nl/ bergmann/crc.bas
Converted to Blitz 2005.1.6
Disclaimer: I program as a hobby. DON'T use this on *ANYTHING* important. User assumes ALL responsibility. Use at your own risk! |
|
|
Title: Digital Countdown Timer
| Code Submitted By: - kryten
 | A digital countdown timer displaying minutes, seconds and tenths of a second. |
|
|
Title: Digital Timer
| Code Submitted By: - rhyswynne
| Convert any time integer into digital timer format. Requires the digitimer Global mentioned at the top of the file (the other's are simply in the demo). |
|
|
Title: Displaying Cash with Commas
| Code Submitted By: - modius
 | Sick of presenting cash as $500000 instead of the much more legible $500,000? Well this code does exactly that. |
|
|
Title: Dragging windows
| Code Submitted By: - thechange
 | Two very simple examples of dragging a single window (or rectangles) across the screen by using the mouse. |
|
|
Title: Dynamic Text Creator
| Code Submitted By: - ionstorm
 | These tools and code, will allow you to create a text than scales with your games resolution, very fast and usefull, well i thought so. If you use it please drop us an email. Email me for the Font and the support files. |
|
|
|
|
Title: Fat Functions
| Code Submitted By: - andy_a
 | Add line thickness to Lines, Rects, Ovals, Stars, & Circles. Rects & Ovals can be rotated in near real time (depending on thickness). All without artifacts (holes) in the thick lines. Commented and has usage examples.
Updated. Now includes fatSuperEllipse() function. Check it out! |
|
|
|
|
Title: Frames Per Second code
| Code Submitted By: - spaceface
| A small piece of code to show the Frames Per Second. You may want to add an Cls() if there isn't one already in the 'If MilliSecs() ...' statement. |
|
|
Title: Get future time
| Code Submitted By: - dabz
| getFutureTime$(time$,hour) time$ - parameter must be in the format HH:MM:SS hours - Adds the amount of hours to the time passed through the 'time$' parameter ----- Returns a string in the format HH:MM:SS with the added hours added!!! :D |
|
|
Title: Gradiator
| Code Submitted By: - thechange
 | Create vertical gradients at runtime. |
|
|
Title: Heat-seaking rocket
| Code Submitted By: - the-mike
 | When the right mouse button is pressed, this will spawn random rockets (add a "rocket.bmp", a rocket faced like this: -->) of random speed and turning rate which will track the mouse. Useful in many 2D game engines! |
|
|
|
|
Title: Line Intersection
| Code Submitted By: - ashcroftman
| returns true if two lines 'touch' Uses maths, not 'per-pixel' so is pretty fast...
|
|
|
Title: Non-Type Based Vector Lib
| Code Submitted By: - world_creator
| Basically instead of having to deal with type declarations (ie. the myVector.Vector) you can use handles to banks instead (ie. just myVector). I've written it with some basis on "temporary" vectors which are deleted automatically when used in a non-value-returning vector function. Included are functions to find the pitch and yaw of a vector, two methods of finding the angle between two vectors, and all three projections. |
|
|
Title: Number Base Conversion with String to Float Capability.
| Code Submitted By: - jimpishlo
| The first of the functions in the code 'xBase2Int' will convert a string holding either a binary, octal, decimal, or hexidecimal value into an integer. See comments for using this function.
The second function 'String2Float' will convert a float value stored in a string into the most accurate float value the system can provide. See comments for use.
Enjoy, -JimPishlo JimPishlo@Comcast.net
|
|
|
Title: Pass Array to Function
| Code Submitted By: - turtle1776
| Want to pass arrays to a generic function that deals with arrays? (like a generic sorting function?). Here's how. |
|
|
Title: Portable Lightmapper
| Code Submitted By: - starfox
 | Here is the lightmapper that I planned to release sooner or later. It isn't perfect, but good enough for my needs since it was only a test, to see I was capable of creating a lightmapper. The only requirement for using this lightmapper is to give me credit in any of the used programs. |
|
|
Title: Powerbar Example
| Code Submitted By: - nacho daddy
 | This an example of a powerbar that I came up with for some mini-games I will be making. One example would be to let the user choose how hard they want to kick a ball. It just goes up and down, and when you click the mouse button(which can be changed to fit your programming needs), the power level is recorded and you can proceed with the game. |
|
|
Title: Quicksort Algorithm Demo
| Code Submitted By: - kawaguy
 | This demo is to implement fast Quicksort Algorithm.
Use a keyed structure (type) for records to be sorted. In this example, random numbers are used for the demo purpose.
For 10,000 records, sorting takes approx. 6/10 of a second on my machine as compared to Bubblesort, approx. 4 secs. If you do the timing yourself, be sure to comment out DebugLog commands.
|
|
|
Title: RGB Color Value Conversion
| Code Submitted By: - thechange
 | Just 4 functions to convert from RGB value to Red/Green/Blue values and vise versa. Especially useful with ReadPixel and WritePixel commands. |
|
|
Title: Random number functions
| Code Submitted By: - badjim
| The Blitz random number functions are bugged, since numbers produced by a given seed can be different from one machine to the next. These replacement functions are consistent across machines. |
|
|
Title: RangeValue function
| Code Submitted By: - thechange
 | Returns capped/warped/shifted value between a minimum and maximum range. |
|
|
|
|
Title: Realtime screen fades
| Code Submitted By: - thechange
 | Fade-in/out routines for Blitz2D, being variations of Snarty's fading routines, which use prebuffering and intelligent pixelwrites to squeeze that extra bit of frames out of your computer. |
|
|
|
|
Title: Recursion without functions
| Code Submitted By: - thechange
 | Search through directory structure without making use of functions or types. |
|
|
Title: Replaying user input using a collection of Types
| Code Submitted By: - matt_sephton
| 23/24 June 2002, version 0.10, tracks user controlled element 26/27 June 2002, version 0.20, tracks multiple computer controlled elements
to do: enable early quit of replay to go back to game
*** feel free to use this method as long as you give me credit
this method can be used to replay user input. this simple demo records the player control of a dot. we choose to do the correct branch of the main loop (moving or drawing) depending on if we are recording (game) or replaying (watching). this could be extended to keep track of multiple items, such as computer/AI controlled characters.
:) matt |
|
|
|
|
Title: Return Values Based on Probability
| Code Submitted By: - shaunsullivan
 | This include will allow you to add a number of possible outcomes (string, int or float), and assign each outcome a relative weight. Then, you can call a function that will return an outcome based on the weight.
For example:
prob_init() ; must call init prob_add_str(10,"shaun") prob_add_str(40,"collin") prob_add_str(50,"sam") local s = prob_roll_str()
; So with the above code it is 10% likely we'll return "shaun", 40% chance we'll return "collin" and 50% chance we'll return "sam" ;(note the weights are just relative, they need not add up to 100) |
|
|
Title: Ripple Shuffle
| Code Submitted By: - thepict
 | This code ripple shuffles a pack of cards |
|
|
Title: Simple Hi Score Function
| Code Submitted By: - benny
 | This is a simple function I created to create and save hi score data. |
|
|
Title: String to integer function
| Code Submitted By: - bagels
| This little function converts a string containing only numeric symbols (0 through 9) into an integer and stores that integer in a global variable (here it's strngtoint, you can easily replace this with your own). |
|
|
Title: The way of pong
| Code Submitted By: - thechange
 | Demonstration of pong collisions without (complicated) maths. |
|
|
Title: Tileable height map generator
| Code Submitted By: - mycroft
 | A recursive function that generates a tileable height map using a midpoint displacement algorithm. The resulting height map has heights from 0.0 to 1.0 (floats/reals). |
|
|
Title: Transparent increment
| Code Submitted By: - thechange
 | Formula for calculating a natural increment from A to B no matter if positive or negative. |
|
|
Title: Tree of Pythagoras
| Code Submitted By: - matt_sephton
 | ;Tree of Pythagoras ; ;Blitz rewrite by Matt Sephton (matt@ewtoo.org) ; ;based on Wouter van Oortmerssen's (http://wouter.fov120.com) ;SHEEP example (http://www.osnews.com/story.php?news_id=169) ;based on an old E example by Raymond Hoving |
|
|
Title: Types within Types
| Code Submitted By: - skn3_acoders
 | You can do types within types with a little bit of pre work making some functions.
Check it out ! |
|
|
Title: Unique Colour Counter
| Code Submitted By: - snarty
 | This function will step through a 24bit image (Created with Flag 4) and return the amount of colours in the image. This will be useful for building palette lists for colour operations.. etc. |
|
|
Title: Vector Graphics Lib With Collisions
| Code Submitted By: - darkeagle
| use vector graphics easily, and check collisions. useful for if you are doing 2d in 3d and are having trouble with collisions - just set up a basic shape for each sprite you are using, then use VectorsCollide() to check for collisions! even includes scaling and rotation :) |
|
|
Title: Vector Matrix Conversion - 2D Angle <-> Coords
| Code Submitted By: - thechange
 | Basically 4 functions to convert from X/Y coordinates to Length/Angle and vise versa. A must for 2D space shooters and related mathematics. The major part of the code contains fun games/examples on how to use the functions, including 2D space physics. |
|
|
Title: Word Counter
| Code Submitted By: - surreal
 | This nifty little algorithm will scan a text file for you and count the number of words in it. |
|
|
Title: WordWrap Function
| Code Submitted By: - scienthsine
| Takes a string, and a Max line length, and returns a string with carrage returns and new lines places in te appropraite places. It breaks on the space right before the max line length. If the entire line is taken up by one word, it breaks on the character that falls on the max line length, and places a "-" dash there. |
|
|
Title: ai Wander source code
| Code Submitted By: - alias jargon
| makes crap wander. no comments. most likely you wont be able to modify and still work unless you are a blitz guru. must create your own "kite.bmp" image. if it dont work use: Global sd=16 ...or else just use that instead to be on the safe side. |
|
|
|
|
Title: real 3d bouncing
| Code Submitted By: - darkeagle
| really really cool... just enable collisions with the world and any objects you want the ball to bounce with, and let this code do its stuff :) bouncy bouncy! |
|
|
• Add Your Code! |