PDA

View Full Version : Boulder Dash



peter
08-07-2009, 22:18
Hi,

a slow Boulder Dash game.
you drive boulderman with the arrow keys.
you put dynamite with your space bar.

you can suck an element like ground or emeralds, therefor
you must press the left -control key and an arrow key in the
direction where you want to suck.

how many gems you have to gather is not shown.
if you have enough, you will hear a sound and the exit is
blinking. now you can run into the exit.
hold distance from the chafers, do not touch they directly.
Peter

matthew
09-07-2009, 04:46
I can't get it to work here peter. The graphics resolution isn't supported by my card.

It's really strange because all your other games worked. Does this game use a different resolution?

martin
09-07-2009, 09:29
Cool! This was my favorite game at the commodore 64. Well done, it works fine here

peter
09-07-2009, 10:53
Hi Matthew,

yes, the resolution is 320x240 here !
was an experiment for me!

Hi martin,
nice to hear that you have fun therewith.
Peter

Petr Schreiber
09-07-2009, 10:59
Hi Peter,

I have the same problem as Matthew.

I would highly recommend to avoid "native" 320x240, during my studies of 3D card manuals I realised the lowest they support is 640x480 usually. Some cards supported 320x240, but it seems with new driver relelases this retro resolution is gone. I will add this info to TBGL help file (EDIT: Done, will be present in next release), it could occur to me.

Now you are probably cursing me, burning my Voodoo doll and things like that. Please don't do that (at least the Voodoo part), because this has one very easy solution - 2D virtual resolution.

Simply create window in 640x480 (which has the same proportions as 320x240 and every card supports it) and use:


TBGL_RenderMatrix2D(0,0,319,239)


That is perfectly enough for rendering sprite based graphics.


Let me know,
Petr

peter
09-07-2009, 13:58
Hi Matthew, Petr

you may try this upload.
there is no another solution therefor.
i'm thinking about a further Boulder Dash, faster, high resolution.
a little bit assembler would be good for the speed.
but unfortunately i cannot oxygen to build in here.
this have to be stand-alone blocks, in the kind of:

oxy_asm : WriteHighScore
mov edi,HsData
xor edx,edx
mov esi,[lev]
dec esi
imul esi,16
mov ax,[Score]
add edi,esi
s1: cmp [edi+edx],ax
jae s2
mov [edi+edx],ax
call SetNames
ret
s2: add edx,2
cmp edx,16
jnz s1
ret
oxy_end

Peter

Petr Schreiber
09-07-2009, 14:04
Hi Peter,

thanks a lot, this worked - it displays the game in upper left quarter of the screen, correct?
I think using my hint from previous post you would get one EXE for all with same quality of fullscreen output ;)


Petr

Charles Pegge
09-07-2009, 14:58
Hi Peter,

Just a brief look at your Asm code:

This compiles okay though I don't know what it does :)

Variable names are normally used directly without square brackets - params translate to [ebp+??] locals: [ ebp-?? ] but to reference thinBasic variables directly you would use this form with the hash prefix. [#myvar] with translates to the absolute address of the thinBasic variable, resolved at Assembly time. eg mov eax,[1244534]

Imul has 3 terms for literal multiply mov ecx,eax,42

The ebx and esi registers carry vital pointers for Oxygen so need to be preserved.

I hope this helps.

Charles




'----------------------------------------
'
'========================================


uses "oxygen","file"
dim src as string

src = "

#basic

function Peter(byval score as long) as long

dim as long lev,HsData

oxy_asm:

push ebx : push esi

WriteHighScore:

mov edi,HsData
xor edx,edx
mov esi,lev
dec esi
imul esi,esi,16
mov ax,Score
add edi,esi
s1: cmp [edi+edx],ax
jae s2
mov [edi+edx],ax
call SetNames
ret
s2: add edx,2
cmp edx,16
jnz s1

pop esi : pop ebx

exit function

SetNames:
'...
ret


oxy_end:

end function

dim a
a=Peter 42
print `ok`
terminate
"
'file_save ( "t.txt", o2_prep src )
o2_basic src
if len(o2_error) then
msgbox 0, o2_error : stop
end if
'o2_exec