10liner basic parallax scrolling

Page 2/3
1 | | 3

By NYYRIKKI

Enlighted (5481)

NYYRIKKI's picture

15-02-2020, 22:48

The game and source are both very lovely. I like this!

Here is direct MSXPen-link:
https://msxpen.com/codes/-M09ofg1kqfj1kyPXDVW

By Dolphin101546015

Master (137)

Dolphin101546015's picture

16-02-2020, 05:08

thegeps wrote:

Explanation is very easy and complete (like a "for dummy") because I had to explain the code to non msx users

Standart RND in MSX Basic is very expensive function by speed Wink

By thegeps

Champion (374)

thegeps's picture

16-02-2020, 12:41

Yep, and sqr too... but in a basic contest you have to use what your basic gives you...

By Dolphin101546015

Master (137)

Dolphin101546015's picture

16-02-2020, 12:54

Actualy - no, your code loking like code of good programmers, then you know another ways for doing it faster Wink

By thegeps

Champion (374)

thegeps's picture

16-02-2020, 12:57

Rnd? Really not (probably it is obvious but I can't see it)

By Dolphin101546015

Master (137)

Dolphin101546015's picture

16-02-2020, 13:14

You have TIME system variable Smile

By thegeps

Champion (374)

thegeps's picture

16-02-2020, 13:23

Yep, I know, but if I need a number in a range 2-18 I had to do too things and I have a 10line limit, 120 chars for each line, line numbers included. And if I have to divide and/or multiply then where is the speed gain?

By Dolphin101546015

Master (137)

Dolphin101546015's picture

16-02-2020, 13:57

thegeps wrote:

Yep, I know, but if I need a number in a range 2-18 I had to do too things and I have a 10line limit, 120 chars for each line, line numbers included. And if I have to divide and/or multiply then where is the speed gain?

X=((TIME and 15)+3)-((TIME and 1)=0)
It's a little longer, but several times faster
Ofc, TIME is not integer, and will give overflow.
But &hFC9E, return BYTE Wink (And FC9F - high byte)

By thegeps

Champion (374)

thegeps's picture

16-02-2020, 13:51

32 chars (after removing unwanted spaces)... very long for a tenliner pure120. Often we have to sacrifice speed to fit code in these contests (but you got a point, it's faster. I can use it sometimes) Wink

By Dolphin101546015

Master (137)

Dolphin101546015's picture

16-02-2020, 13:56

It was a little inaccurate in the range, but you get the point Smile

Page 2/3
1 | | 3