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

Topics - Sokurah

Hi guys,

I've decided to put a link to my latest remake here. It's in BlitzMax and not in GLBasic - I've still only done the one in GLB (Binary Land) - but as you're programmers and love games like me ...and may not check the same sites as I do, I think there might be a chance you'll appreciate it anyway. ;)

The original arcade game was originally made by Atari in 1982 and since I love it I've remade it - like so many other vectorgraphics games - with glowing graphics.

QuoteBlack Widow is an arena-shooter, where the object is to defeat the insects and get as far as you can. As a spider in the center of the web, you must defend it and yourself from invading bugs. These foes will try to run into you, blow you up if shoot them, or fire rockets at you if you do not kill the other enemies! It has been described as a cross between Robotron: 2084 due to one joystick being used for movement and another one for firing. Does not have as many objects on the screen as Robotron but gets quite intense anyway.

You can get the game from my site, here: ...and like all my other games, it's absolutely free.  :)

Here's a couple of pictures of it; will also do pure lines if you're not into glowing graphics

I've been wondering if I should get one of these tablets that runs Android 2.2.

It's not like i need one - I already have both an iPad 2 & 3, but I don't have any Android devices and this one seems like an okay Android pad to have a bit of fun with, but I'm wondering how performance with GLBasic is?

...and how is it - if anyone knows - compared to the Zixoon a71 tablet that Gernot gave away recently (which is even cheaper)?
Perhaps, for those who like to follow updates on Twitter too, we can have a thread with our usernames?
...I elect this thread to be it. :D

I'm @Sokurah.
Argh, I've lost so much time to this already. It's a VERY weird problem so this will be a long post.

A few days ago I decided to port my Omega Race 2009 remake to GLBasic so I can get it running on the iPad and I've finished most of it already (probably because I've been able to work on it both at home and at work ;)). But now I've run into a weird problem that I just can't figure out.

Early on in the porting process I ported my 'textwrite' function and it worked beautifully and didn't give me any problems at all. Then last night I was working the intro for the game and suddenly the textwrite function started behaving weirdly. I sat with it last night hoping I'd just confused some variables and somehow fooked it up, so I kept tweaking and tweaking and hoping I'd get it right...although it should've been working. It's not the first time I've made a textwrite function after all, so I know what goes into it.

In the end - last night - I decided that I couldn't solve the problem, so I just dropped it and decided to just continue at work today with the functioning version I had there. And it worked...just like it did yesterday.
So all day today I've been working on it - mostly on the menu system, and it's been working as it should. What a relief.

So I did what I always do after a home or at work  - I RAR everything down and put it in my DropBox so I can pick up where I left.
Which I did tonight when I got home. Guess what? It didn't work at home. But it did at work. Gahh!!!

The problem with the textdrawing routine is that instead of drawing the expected characters I get the "unknown" character instead (the one I'm using when the program can't find data for it). For some reason it's usually the second character in a string that it can't find.

First a bit of code, but to be quite honest I don't think it's my code, because it's worked nicely in the original Windows version, in and Binary Land (which I also did in GLB) and in countless other games...until here last night.

To print text I do this; (the ¤ is the copyright character)

VectorFont("¤(2011) by sokurah -", 9, 35, RGB(255,0,0), 0, 0.75, 0.75, 0)

VectorFont("play", 7.8, 7.5, RGB(255,64,64), 0, 2,1.5, 0)
VectorFont("settings", 8.75, 9, RGB(64,64,255), 0, 1.5,1.5, 0)
VectorFont("  credits", 7.25, 10.5, RGB(64,255,64), 0, 1.5,1.5, 0)

(the parameters are: text,x,y,color,rotation,xsize,ysize,not-important)

Now, the strange thing is that if I reverse those two first lines - like this - I get very different results.

VectorFont("¤(2011) by sokurah -", 9, 35, RGB(255,0,0), 0, 0.75, 0.75, 0)

VectorFont("play", 7.8, 7.5, RGB(255,64,64), 0, 2,1.5, 0)
VectorFont("settings", 8.75, 9, RGB(64,64,255), 0, 1.5,1.5, 0)
VectorFont("  credits", 7.25, 10.5, RGB(64,255,64), 0, 1.5,1.5, 0)

Next up are two pictures showing how it looks with the 2 first code lines, then a picture where they are reversed. It's worth noting that although I said it's usually the second character that is fooked up - in the first picture it doesn't seem to be the case where it says 'credits', but it is - because there's two spaces before it, so the # character is actually in the second position. Also note that the copyright message at the bottom doesn't work at all with the lines the first way, but perfectly in the other way.

But when I change those two first lines around I get a lot more "unknown characters" - but the copyright message doesn't make sense.

And please remember that it works perfectly at work, but not on my two computers at home. Sometimes I "only" get this problem...sometimes it just crashes and locks up.  :(

...and if you want a bit more code, then I'll insert a bit of the textroutine at the bottom, but to be honest I think it's somehow a combination of GLB and the hardware it's running on. I would be happy to get some help here.  :nw:

Code (glbasic) Select

//This is used to define the characters allowed, at the top of the program
GLOBAL font$=" abcdefghijklmnopqrstuvwxyz¤0123456789.,?=/-+()':;@!*>#"

//Then a bit of the print itself
FUNCTION VectorFont:str$, x#, y#, col%, ang#, xzoom#, yzoom#, precise%
FOR b = 0 TO LEN(str$)-1
str3$ = LCASE$(MID$(str$, b, 1))
IF a<0 THEN a=54//replace unknown char.
//Do the vectorstuff here
x = x + 1

In theory:

If I make something that is based on squares I would normally use tiles.
Let's say I was making a scrolling game and using 32x32 or 64x64 sized tiles.

But what if the playfield is 1024x1024 pixels and I use a 1024x1024 pixel scrolling image and just changed the offset at where it was drawn and do the scrolling that way?
-would there be a speed penalty for using an image that big, or would GLB clip it correctly so it doesn't matter?...would it be a good alternative to tiles (in this theoretical example) or should I just stick to tiles?
I'd be happy if someone could compile this little program for iPhone for me...all for the cause of fun and games. :D
It's pretty simple stuff - a picture is shown, press the screen and a sound is played.
All I need is an ipa file I can install on my phone.

The source will probably need to be tweaked a bit, but it should be there mostly.
The needed png is attached. I can't attach the OGG, but you can get it here.
Edit: Added an icon.

Code (glbasic) Select

SETSCREEN 320,480,0

LOADANIM "rimshot.png",0,320,480

GLOBAL frame%=0
GLOBAL count%=0
GLOBAL a%=0,b#=0,temp#

DRAWANIM 0,frame%,0,0

MOUSESTATE temp#, temp#, b#, temp#
IF b#=1
PLAYMUSIC "rimshot.ogg",FALSE

IF count%>0
IF count%=0 THEN frame%=0


[attachment deleted by admin]
In BMax I normally use this when printing the score on the screen;

DRAWTEXT ("score: " + Replace:String(RSet:String(Score, 7), " ", "0"), 1, 1)

This example will print the score, aligned to the right, and padded with zeros on the left to be 7 characters wide.

Is there a way to do the same, as efficiently, in GLB?
I've got a few things that are driving me nuts.

How do I clear the keyboard buffer?
Say you have a menu and you select an option or a submenu by using the ENTER key. So I press ENTER. If I come to a submenu where I can also press ENTER to select something, it is selected right away. Damn annoying. In BlitzMax I almost always use Delay 100 followed by Flushkeys after reading the keyboard (for menu related things). But none of those commands are available in GL and I can't find anything else that does the same thing.

Shouldn't the GL command KEYWAIT be called SOMEKEYSWAIT? </sarcasm>
Seriously?...why does this command not register the ESC and arrowkeys?

...and more (yeah, lots of keyboard related problems).  =D
I need a 'PressAnyKey' function so I tried this;

Code (glbasic) Select
WHILE a%=0
FOR b%=1 TO 255
IF KEY(b%) THEN a%=b%

//I even tried adding this but I still can't make it behave the way I want it to.
WHILE a%<>0

But that doesn't work. All these problems are because I can't find a way to clear the keyboard buffer, and because the KEY command is so sensitive.

Gernot, I realise that you can't add all the commands from BlitzMax, because then it'd be BlitzMax :) ...but BM has the command KEYDOWN which does the same as KEY in GL, but it also has the command KEYHIT which registers ONE keyhit and doesn't continue until the key is no longer pressed. Could you perhaps add a command like that?

Can anyone help with these small things?...perhaps guide me in the right direction?
In BlitzMax I would normally clear a TYPE by doing so;


...but how would I clear this one in GLBasic?

GLOBAL EnemyTYPE[] AS Enemies

Can it be done with one command like in Blitz?
In BlitzMax you can do this;

QuoteIncbin "res\backdrop.jpg"
Global BackdropGFX:TImage = LoadImage ("IncBin::res\backdrop.jpg")

Is there a way to embed binaries into the EXE file so you don't need external ressources?

Edit: I just read about the "ShoeBox-Standalone" proggy but it's hardly a usable option since it's not guaranteed to work across all platforms.
Anyway, I'm mostly interrested in how to do it on the iPhone.