May I take the opportunity to wish everyone on this list a Merry Christmas.

I have been trying to write what I thought would be a simple point and shoot 
game in BASIC using Easyptr. The mouse controls a pointer which shoots at the 
moving target using a routine similar to the much simplifed code below which I 
hope will adequately explain what I am trying and failing to achieve

OUTLN #0
REPeat loop
RDPT #0, tvec%,xpos%,ypos%,time%
IF mouse button down and pointer position is same as target
  hit routine, score etc
END IF
move target position (simple animation only)
END REP loop

Don’t worry about the undefined variables in the RDPT command, I just omitted 
them to keep the skeleton program short. tvec% is just the termination vector, 
xpos% and ypos% are pointer position set and return values and time% is a 
timeout (0 or other low value).

The problem is unexpected, but I think I see why it’s happening and I need to 
find a different way of writing this.

The pointer appears during the RDPT command (which reads the keyboard with 
either zero timeout or very short timeout as a simple speed control mechanism) 
and disappears between the RDPT command and the end of the loop, so the pointer 
flashes a lot. In fact with a timeout of zero or close to zero the pointer 
doesn’t appear at all (presumably loop iteration is faster on QPC2 than the 
screen refresh can keep up with). The pointer arrow is seen on screen far less 
than it is invisible.

What I need to achieve of course is a steady pointer which doesn’t flash on and 
off so irritatingly.

I have considered and tried:

1. A pointer of 0x0 pixels in size
2. A transparent pointer

and in both cases keep reading pointer position and draw my own little 
cross-hair pointer at that position in place of the system pointer. In all 
cases it either fails completely with no error message or even drawing my own 
pointer is very jerky and doesn’t really keep up with pointer movement which as 
you can imagine in a game like this can be pretty quick at times.

Anyone got any more ideas as to how I might go about this in a different way 
perhaps? Or what I might be doing wrong?

The game itself is basically a set of jack-in-the-boxes popping up in random 
places which you have to “splat” with the pointer to hit as many as you can in 
half a minute.

Dilwyn Jones
_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to