1. Newbie seriously confused.

I have spent a good deal of time using darkbasic, another popular 
game-making language.  I made some simple games on it, but found the 2d 
too slow for my liking.

Anways....I understand all the basic principles, and I'm trying to make 
some simple programs displaying pictures and graphics and such, but I 
don't quite understand the graphics commands.

If I wanted to paste a picture to the screen, and move it about with the 
arrow keys, how would I? Could anyone give me a very simple example?

new topic     » topic index » view message » categorize

2. Re: Newbie seriously confused.

Mike,

    If your used to darkbasic, and are interested in game programming, you
should try exoticaX, I hear that allegro is also good. I can't speak for
allegro, as I use my exoticaX API.

But they are both designed for game programming.
ExoticaX will let you use directX, and it come with lots of demos to show
you how to do everything.

I'm on the verge of a new release that comes with a very functional gui API
to help set  up user interfaces as well. Probably within a couple of weeks.

Chris

> I have spent a good deal of time using darkbasic, another popular
> game-making language.  I made some simple games on it, but found the 2d
> too slow for my liking.
>
> Anways....I understand all the basic principles, and I'm trying to make
> some simple programs displaying pictures and graphics and such, but I
> don't quite understand the graphics commands.
>
> If I wanted to paste a picture to the screen, and move it about with the
> arrow keys, how would I? Could anyone give me a very simple example?

new topic     » goto parent     » topic index » view message » categorize

3. Re: Newbie seriously confused.

--Boundary_(ID_hfu5jGS/m2dQ4XdqNpLFFw)

On Thursday 23 August 2001 22:22, mike johnson wrote:

> I have spent a good deal of time using darkbasic, another popular
> game-making language.  I made some simple games on it, but found the 2d
> too slow for my liking.
.....
> If I wanted to paste a picture to the screen, and move it about with the
> arrow keys, how would I? Could anyone give me a very simple example?

Here's about the simplest you can get:

constant instructions =
 "Hit any key to display Bart,\n"&
 "Use arrow keys to move, ESC to quit"

include get.e -- for wait_key()
include image.e -- for bitmap

object coords, oldcoords, size, img, bkgnd
integer key, step
constant PAL = 1, BMP = 2

coords = {100,100} -- initial starting point.

img = read_bitmap("C:\\euphoria\\bart.bmp")
size = {length(img[BMP][1]),length(img[BMP])}
step = 5 -- move by this many pixels each time.

-- Set up graphics mode and display instructions:
if graphics_mode(256) then
   puts(1,"Cannot select graphics mode")
   abort(1)
end if

all_palette(img[PAL]) -- set DOS palette to match bitmap's
bkgnd = save_image(coords,coords+size)
puts(1,instructions)

while 1 do -- check for keypress, move image:
 key = wait_key()
 oldcoords = coords
 if key = 27 then exit
 elsif key = 333 then coords += {step,0}
 elsif key = 336 then coords += {0,step}
 elsif key = 328 then coords -= {0,step}
 elsif key = 331 then coords -= {step,0}
 end if
 display_image(oldcoords,bkgnd)
 display_image(coords,img[BMP])
end while

Regards,
Irv

--Boundary_(ID_hfu5jGS/m2dQ4XdqNpLFFw)
Content-type: image/x-bmp; charset=iso-8859-1; name=bart.bmp
Content-transfer-encoding: base64

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu