1. Bad Co-ordinates

------=_NextPart_000_000B_01C027D7.B2652980
        boundary="----=_NextPart_001_000C_01C027D7.B2652980"


------=_NextPart_001_000C_01C027D7.B2652980
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Well, I've written a program with a lot of help from Brian and it's =
still.....broken. My fault really. Anyways, I've attatched it and the =
problems are..

1. If you move left to the limits, it crashes
2. If you go too far right, well, it goes to far (past screen limits) =
and you can't go left. I know what the problem is, but the solution     =
evades me.
3. There seems to be a green border in 256 mode......


I think most of the programs problems radiate around the < and > =
things.Hmrm, oh, right, I'd like to know: can I so something like: if =
desc=3D RIGHT and UP then       <<<< You'll have to look at the program
That's it............for now,


Quoth the program,"Nevermore"
-Thomas

PS. How d'you like my jet?


------=_NextPart_001_000C_01C027D7.B2652980
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Well, I've written a program with a lot =
of help=20
from Brian and it's still.....broken. My fault really. Anyways, I've =
attatched=20
it and the problems are..</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>1. If you move left to the limits, it=20
crashes</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>2. If you go too far right, well, it =
goes to far=20
(past screen limits) and you can't go left. I know what the problem is, =
but the=20
solution &nbsp;&nbsp;&nbsp; evades me.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>3. There seems to be a green border in =
256=20
mode......</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I think most of the programs problems =
radiate=20
around the &lt; and &gt; things.Hmrm, oh, right, I'd like to know: can I =
so=20
something like: </FONT><FONT face=3DArial size=3D2>if desc=3D RIGHT and =
UP=20
then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;&lt;&lt;&lt; You'll have to =
look at=20
the program</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>That's it............for =
now,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Quoth the =
program,"Nevermore"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>-Thomas</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>PS. How d'you like my jet?</FONT></DIV>

------=_NextPart_001_000C_01C027D7.B2652980--

------=_NextPart_000_000B_01C027D7.B2652980
        name="jetmove.bmp"

new topic     » topic index » view message » categorize

2. Re: Bad Co-ordinates

On Tue, 26 Sep 2000 16:34:52 -0700, Thomas wrote:

>Well, I've written a program with a lot of help from Brian and it's
>still.....broken. My fault really. Anyways, I've attatched it and the
>problems are..
>
>1. If you move left to the limits, it crashes

Then don't let it move left to the limits...

>2. If you go too far right, well, it goes to far (past screen limits) and
>you can't go left. I know what the problem is, but the solution evades
>me.

Check your logic...  you rather mangled the structure of the code I gave
you and that makes it more difficult to find errors in logic.

>3. There seems to be a green border in 256 mode......

That is a result of using 'all_palette'.  I don't remember which palette
index corresponds to the border color, but you are changing it from black
to green when you use 'all_pallete'.

>PS. How d'you like my jet?

Nice jet...


Try this:
---------

include image.e
include keyread.e
include graphics.e

---lalala

constant
  -- Scan Codes:
  ESC = 1,
  UP = 328,
  DOWN = 336,
  LEFT = 333,
  RIGHT = 331,

  -- Indexes to enhance readability of code:
  X = 1,
  Y = 2,

  MoveStep = 5,       -- number of pixels to move jet on key press
  BmpSize = {63,76},  -- size of bitmap
  MAX = {640,400}     -- size of screen in mode 256


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,"arrows move, ESC quits")

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

while 1 do
  desc = get_keys()
  position(2,1)
  ? desc
  display_image({ix,iy},jetmove[2])  -- show jet
  if length( desc ) > 0 then         -- a key is being pressed
    if desc[1] = ESC then
        abort(0)
    elsif desc[1]=LEFT then
      if ix < MAX[X]-BmpSize[X] then
        ix += MoveStep
      end if
    elsif desc[1]=RIGHT then
      if ix > 0 then
        ix -= MoveStep
      end if
    elsif desc[1]=UP then
      if iy > 0  then
        iy -= MoveStep
      end if
    elsif desc[1]=DOWN then
       if iy < MAX[Y]-BmpSize[Y] then
         iy += MoveStep
       end if
    end if
    wait(0.0005)
  end if
end while
-- Brian

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

3. Re: Bad Co-ordinates

------=_NextPart_000_001B_01C027E8.7B35E740
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

To Brian:

It's true, I did mangle the code, I was trying to intgrated into the =
640X400 mode, I guess I messed it up. Thanks for the e-mail.

------=_NextPart_000_001B_01C027E8.7B35E740
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>To Brian:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>It's true, I did mangle the code, I was =
trying to=20
intgrated into the 640X400 mode, I guess I messed it up. Thanks for the=20

------=_NextPart_000_001B_01C027E8.7B35E740--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu