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.

Show posts Menu

Messages - Ian Price

It doesn't matter how you get things to work, as long as they do! :D

I don't suppose for a second that my version is cleaner or greener than anyone elses, but it's mine and it works, so the job's a good one :)
I originally tried a GrabSprite routine, but the masking didn't appear to work properly - neither of the mask colours came through. Admittedly I didn't spend a lot of time playing with it - I've been busy with other routines and doing the level editor and getting the game working properly :)

What I actually meant (about LoadSpriteAnim) though is that it should be an automated and included command and not just a function.

[EDIT] Sorted :D

Here's my Bitmap Font function (for fonts 6x9)

Code (glbasic) Select
GLOBAL width=6, height=9

LOADSPRITE "gfx/font.png",1000

DRAWRECT 0,0,640,480,RGB(255,0,128)



WHILE n<97

GRABSPRITE n,x,y,width,height



IF x>186



DRAWRECT 0,0,640,480,RGB(255,255,255)

txt(100,100,"Ian Price was here!")



// Display bitmap Text
FUNCTION txt: x, y, ss$

  FOR i=0 TO LEN(ss$)-1

    DRAWSPRITE cr,x+(xpos*width),y

    // Kern text
    IF cr=42 OR cr=74 THEN x=x-4
    IF cr=9 OR cr=10 OR cr=77 THEN x=x-3
    IF cr=1 OR cr=18 OR cr=75 THEN x=x-2
    IF cr=85 THEN x=x-1

Values relate to sprite image number of individual letters, with a full 96 character font (as seen below).

**** Incidently, this could be used for animated sprites too :D
I've got a bitmap font running too - uses pretty much the same code I used in my Blitz (inc Max) and PlayBasic games. The basic core of the language is very similar to pretty much all Basic languages really, only the names of the commands have been changed to protect the innocent :P

I just wish there was a proper LoadSpriteAnim command that allowed easy and quick loading of tilemaps/multiple images to put into sprites. :( Gernot...
Nice one PeJay :)
Quote from: Schranz0rHmm Gernot i think RND(0,9) for example, could be better then RND(9).
So you can do RND(5,10),  5 MIN 10 MAX....
Should be easier to use...

@ iprice

you can use that:

negativ and positiv values!

ex.: RAND(-10,10) or RAND(10,20) or something like ;)

Code (glbasic) Select
FUNCTION RAND: minimum, maximum

RETURN minimum + RND(-minimum + maximum)

That's very similar to the function I came up with :)
I know that GLBasic supports random numbers in the form of RND(Max), but this always returns a value between 0 and the Max value.

Is there a command like RAND(Min, Max), where the command returns a value between (and inclusive of) the two values?

I have only skimmed through the Index, so maybe I missed a similar command. Does it exist, and if not, can it be added?

[EDIT] BTW I created a function to do this, but a built in command could be useful to newcomers.