Saturday, January 11, 2014

HP Prime: Waterfall Animation

HP Prime: AMNI10
Waterfall Animation

Background boxes with falling water. There is random mist coming from the water.
Colors:
Blue: #FFh, RGB(0,0,255)
White: #FFFFFFh, RGB(255,255,255)
Brown: #964B00h, RGB(150,75,0)
Grass Green: #DA00h, RGB(0,218,0)




EXPORT AMNI10()
BEGIN
// 2014-01-10 Waterfall EWS
LOCAL K,J,I,A:=0;
RECT();

WHILE GETKEY==-1 DO
A:=A+1;

// Static
// Walls
RECT_P(0,5,30,210,#964B00h);
RECT_P(280,5,318,210,#964B00h);
// Water
RECT_P(30,10,280,210,#FFh);
// Grass
TRIANGLE_P(0,210,155,230,318,210,
RGB(0,218,0));

// Animated
// Mist
FOR I FROM 1 TO RANDINT(50,75) DO
TEXTOUT_P(".",RANDINT(30,270),
RANDINT(10,200),3,#FFFFh); END;
// Foam
FOR I FROM 1 TO RANDINT(100,125) DO
TEXTOUT_P("=",RANDINT(25,290),
RANDINT(200,210),3,#FFFFFFh); END;
// Fall
RECT_P(30,10+25*(A+1),280,10+25*A,
#FFFFFFh);
WAIT(0.1);
IF A==8 THEN
A:=0; END;

END;
END;
I realize this is more a picture one would see when running an Atari 2600 game.  I guess the point is how to layer graphics so that the static elements are drawn first, then the animated elements.

Eddie


This blog is property of Edward Shore. 2014

2 comments:

  1. Great blog and excellent work!
    I have been learning a lot from your posts.
    Thank You!

    ReplyDelete
    Replies
    1. Thank you for the kind words, Suna! Appreciate it.

      Eddie

      Delete

Eclipse and HHC 2017

Eclipse On August 21, 2017 there will be a solar eclipse.  Totality (where the moon completely covers the sun) will occur in the northern...