123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|518|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Jerky Movement

Tue, 02 Apr 2013, 21:30
dna
Here's some code that I wanted the little square to move smoothly across the screen.



Another website told me to use floats which I did but nothing changed. Thanks for the help in advance.

-=-=-
DNA
Wed, 03 Apr 2013, 00:52
rockford
If you want smooth movement on any machine then "delta timing" is something you may want to look at.

Basically delta timing involves increases or decreases in the positional movement of an object over a set period of time. This means that on a slow computer the object may move 10 pixels every step whereas on a fast pc the object may move 2 pixels per step - both will move the same number of pixels in the same time limit, but the fast pc will make the movement appear smoother.

I don't use it myself (I've never seen conclusive proof that this does actually gives smoother movement), as realistically your pc may be doing other things in the background, which changes constantly and therefore affects the CPU time being used in your program. All you can do is give the impression of smooth movement by being consistant with your movement code.

Be aware that floats can give odd readings when checking for collisions too, so you might get smoother movement, but your player might also go through walls or floors!
Wed, 03 Apr 2013, 02:04
waroffice
you went to another website?
Wed, 03 Apr 2013, 09:56
Dabz
I'd say your code is a bit messy, and defo in need a tidy up... Make it a little more readable... Anyway, if you looksy here:-

www.blitzbasic.com/bpdocs/command.php?name=Flip&ref=2d_a-z

How does the example in the link run for you?

If you want to move it using the KeyDown whatsit, you can change it too something like:-



Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Wed, 03 Apr 2013, 14:24
dna
Thanks Dabs. My code was misorganized.


I reformatted it and got better results.
Thanks


-=-=-
DNA