FAQ  •  Register  •  Login

too fast :)

<<

slenkar

Posts: 260

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Tue Feb 22, 2011 12:48 am

too fast :)

i have a cursor that i move around the screen with the keys but its too fast

when i press "p" it shoots half way across the screen, how do i make it move 1 square every half a second
<<

LCD

Posts: 507

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Tue Feb 22, 2011 7:05 am

Re: too fast :)

Just enhance the "resolution" of calculation, lets say, by 8 (then divide the coordinate by 8 to get he correct position). Also using PAUSE 1 in loops to slow it down, is a passibility.
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

slenkar

Posts: 260

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Tue Feb 22, 2011 4:35 pm

Re: too fast :)

thanks that slowed it down,

I want the cursor to move continuously if the key is held down for 1.5 seconds, how do I measure that time?
<<

LCD

Posts: 507

Joined: Fri Feb 13, 2009 3:11 pm

Location: Vienna, Austria

Post Wed Feb 23, 2011 5:04 pm

Re: too fast :)

slenkar wrote: I want the cursor to move continuously if the key is held down for 1.5 seconds, how do I measure that time?

You can use the FRAMES systemvariable (3 bytes at 23672). For 1.5 seconds just wait until the first byte (or was it last?) is greater than 73, now you can do your action. Then poke it again with zero. If you not want to reset it for some other reaseons, can also use all three bytes together, and calculate a modulo of 75 from it, but I prefer to reset it, and use one single byte, or two bytes (Uinteger) for speed reasons (65536 Frames=1310 seconds=21 minutes).
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
<<

slenkar

Posts: 260

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Sun Oct 30, 2011 4:25 pm

Re: too fast :)

could I have an example please?

so is there a system timer, that can be read from and written to?
<<

britlion

Posts: 679

Joined: Mon Apr 27, 2009 7:26 pm

Location: Slough, Berkshire, UK

Post Sun Oct 30, 2011 6:09 pm

Re: too fast :)

You should have a look at Chapter 18 of the Sinclair ZX Spectrum manual.

http://www.worldofspectrum.org/ZXBasicM ... hap18.html
<<

slenkar

Posts: 260

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Sun Oct 30, 2011 10:27 pm

Re: too fast :)

ah very good thanks
<<

boriel

Site Admin

Posts: 1147

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Oct 31, 2011 10:18 am

Re: too fast :)

This example has been already implmented in the Wiki (look in your /examples directory).
See here http://www.boriel.com/wiki/en/index.php ... :Clock.Bas
and here http://www.boriel.com/wiki/en/index.php ... Clock2.Bas
<<

slenkar

Posts: 260

Joined: Sun Feb 13, 2011 3:33 am

Location: Kentucky US, used to be Birmingham UK

Post Mon Oct 31, 2011 2:26 pm

Re: too fast :)

thanks

Return to Help & Support

Who is online

Users browsing this forum: No registered users and 0 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO