Text Only
|
Text with Attachments
QB64.org Forum
Active Forums => Programs => Topic started by: Virtusoroca on May 10, 2020, 06:46:46 pm
Title:
ASCII Animation Code | Not efficient but easy and informative
Post by:
Virtusoroca
on
May 10, 2020, 06:46:46 pm
To be integrated in ASCII Terrain Egine 1.3
Code: QB64:
[Select]
SCREEN
_NEWIMAGE
(
800
,
800
,
256
)
PRINT
"ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»"
PRINT
"º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ ASCII TERRAIN ENGINE ÛÛßßÛÛ ÛÛßßÛÛ º"
PRINT
"º ÛÛ Û ÛÛ ® Animation Module ¯ ÛÛ ÞÛÛ ÛÛÛÛÛ º"
PRINT
"º ÛÛ Û Û Û ÛÛ (to be integreated in v.1.3) ÛÛÜÞÛÛ ÛÛÜÜÛÛ º"
PRINT
"º Û Û Û Not efficient but informative ßß º"
PRINT
"º ÛÛ Û Û Û ÛÛ ------------ ÛÛßßßß ÛÛ ÛÛ º"
PRINT
"º ÛÛ Û Û ÛÛ By Virtusoroca-Brazil, 2020 ÛÛßßÛÛ ÛÛÜÜÛÛ º"
PRINT
"º ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ Made in QB64 ÛÛÜÜÛÛ ÛÛ º"
PRINT
"ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ"
TYPE
Players: x
AS
INTEGER
: y
AS
INTEGER
:
END
TYPE
DIM
SHARED
Player
(
1
)
AS
Players
DIM
SHARED
KeyPress
AS
STRING
Player
(
1
)
.x
=
25
: Player
(
1
)
.y
=
40
COLOR
7
DO
UNTIL
KeyPress
=
"Q"
_LIMIT
30
KeyPress
=
UCASE$
(
INKEY$
)
PCOPY
_DISPLAY
,
1
MovePlayer
CheckLimit
_DISPLAY
PCOPY
1
,
_DISPLAY
LOOP
:
CLS
:
END
SUB
MovePlayer
SELECT
CASE
KeyPress
CASE
CHR$
(
0
)
+
CHR$
(
72
)
: Player
(
1
)
.x
=
Player
(
1
)
.x
-
1
:
IF
(
Player
(
1
)
.x
MOD
2
)
=
0
THEN
FrameU1:
ELSE
FrameU2
CASE
CHR$
(
0
)
+
CHR$
(
80
)
: Player
(
1
)
.x
=
Player
(
1
)
.x
+
1
:
IF
(
Player
(
1
)
.x
MOD
2
)
=
0
THEN
FrameD1:
ELSE
FrameD2
CASE
CHR$
(
0
)
+
CHR$
(
75
)
: Player
(
1
)
.y
=
Player
(
1
)
.y
-
1
:
IF
(
Player
(
1
)
.y
MOD
2
)
=
0
THEN
FrameL1:
ELSE
FrameL2
CASE
CHR$
(
0
)
+
CHR$
(
77
)
: Player
(
1
)
.y
=
Player
(
1
)
.y
+
1
:
IF
(
Player
(
1
)
.y
MOD
2
)
=
0
THEN
FrameR1:
ELSE
FrameR2
CASE
""
: FrameS
END
SELECT
END
SUB
SUB
FrameS
'STILL
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
"³Û³"
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
" º "
END
SUB
SUB
FrameU1
'UP
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ|"
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
"³° "
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
" Þ "
END
SUB
SUB
FrameU2
'UP
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
"|þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
" °³"
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
" Ý "
:
END
SUB
SUB
FrameD1
'DOWN
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
"|Û "
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
" Þ "
END
SUB
SUB
FrameD2
'DOWN
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
" Û|"
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
" Ý "
END
SUB
SUB
FrameL1
'LEFT
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
".Û "
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
" Ý\"
END
SUB
SUB
FrameL2
'LEFT
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
" Û "
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
"<Þ"
END
SUB
SUB
FrameR1
'RIGHT
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
" Û."
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
"/Þ "
END
SUB
SUB
FrameR2
'RIGHT
LOCATE
Player
(
1
)
.x
+
0
,
Player
(
1
)
.y:
PRINT
" þ "
LOCATE
Player
(
1
)
.x
+
1
,
Player
(
1
)
.y:
PRINT
" Û "
LOCATE
Player
(
1
)
.x
+
2
,
Player
(
1
)
.y:
PRINT
" Ý>"
END
SUB
SUB
CheckLimit
IF
Player
(
1
)
.x
<=
2
THEN
Player
(
1
)
.x
=
2
IF
Player
(
1
)
.x
>=
45
THEN
Player
(
1
)
.x
=
45
IF
Player
(
1
)
.y
<=
2
THEN
Player
(
1
)
.y
=
2
IF
Player
(
1
)
.y
>=
85
THEN
Player
(
1
)
.y
=
85
END
SUB
Text Only
|
Text with Attachments