Main Menu

Asc II Maps

Started by LemonWizard, April 30, 2008, 03:57:02 PM

Previous topic - Next topic

LemonWizard

Two simple sample runs I've done using some of the basic commands.
I'm a beginner with play basic but I've used a compiler that's similiar to playbasic in the past so while I am a newbie at this there is still some things I catch onto very easily...

I find it interesting and fun to use randomizer sequences. I've been playing with the dot command to test pixel coordinates, rendering time.. etc..

Going to develop a timer script soon that tests how many pixels can render on the screen for the cpu playbasic is running on... most computers are different in minor ways.

Anyhow..

This is will map out ascII characters randomly... a 30 by 30 character map.
Something like this would be good for developing a 2d ASCII game... like an ASCII version of pacman.
Right now it's fairly sloppy... but I had fun making it. Total time.. approx five to ten minutes.


Dim TMAP(30,30)

Dim Characters(255)
for tempchar=1 to 255
characters(temp)=rnd(255)
next tempchar

For tempx=1 to 30
for tempy=1 to 30
tempchar=rnd(20)
setcursor tempx*10,tempy*10
print chr$(characters(tempchar))
sync
wait 5
gosub getinput
next tempy
next tempx
:end
getinput:
a$=inkey$()
if a$="a" then :end
return



This one below is a pixel map randomizer... play around with it and see what happens.
It uses random color codes. With the wait command you can vew the pixels being printed on the screen in rows. It's fun to watch.
It demonstrates how simple for temp loops, and the dot command can be used to draw sprites.


For tempy=1 to 500
For tempx=1 to 500
R=rnd(255)
B=100
G=100
If R <100 then R=100
Box1=rnd(600)
Box2=rnd(600)
Ink rgb(R,B,G)
Dot Tempx,Tempy
sync
wait 1
next tempx
next tempy
:END