Jet Game

new topic     » topic index » view thread      » older message » newer message

Hello All,

I believe that Paul Kerslake sent in the origional code for this but I don't
recall exactly off the top of my head.

Anyway Paul wrote
"I've been working on my "jet" program which, if it gets finished, I will
send you."

and it reminded me that I was playing with that code a bit.

Note: The bitmap used is not included.

My modifications allow the ship to move diagonally by holding key
combinations of Left + UP, Left + Down, Right + Up, Right + Down.  Note
however that Left + Right or Up + Down cancel each other out and the ship
does not move.  The ESC key quits the program.

--Code follows--

include image.e
include keyread.e
include graphics.e
---lalala
constant
UP = 328,
DOWN = 336,
LEFT = 331,
RIGHT = 333,
X = 1,
Y = 2,
MAX ={640,400}

integer gmode
sequence jetmove,desc
integer ix,iy
ix=200
iy=300

use_vesa(1)
gmode=graphics_mode(256)

jetmove=read_bitmap("jetmove.BMP")
all_palette(jetmove[1]/4)
text_color(10)
puts(1,"f for ->...j for <- ...u for /\\....d for \\/")

 procedure wait( atom n )
    n += time()
         while time() < n do
       end while
   end procedure

while 1 do
        desc=get_keys()
        position(2,1)
        ? desc

        if length( desc ) > 0 then
            if find(1,desc) then
            abort(1)
        end if

        if find(RIGHT,desc) and ix < (MAX[1]-60) then
                        ix += 4
--                      display_image({ix,iy},jetmove[2])
                end if

                if find(LEFT,desc) and ix > 4 then
                        ix -= 4
--                      display_image({ix,iy},jetmove[2])
                end if

                if find( UP, desc ) and iy > 1 then
                        iy -= 4
--                      display_image({ix,iy},jetmove[2])
                end if

        if find( DOWN, desc ) and iy < MAX[2]-80 then
                iy += 4
--              display_image({ix,iy},jetmove[2])
        end if
        end if
        display_image( {ix,iy}, jetmove[2] )
        wait(0.00001)

end while


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu