## Генератор роботов

goglus
Posts: 122
Joined: Tue Dec 04, 2007 4:19 pm
Contact:

### Генератор роботов

Дальнейшее развитие генератора уродов (если кто подскажет более вменяемые руки-ноги буду благодарен)

Code: Select all

``````//pixilang (2009)
X=-90
body = new_pixi( 5, 7, 1 )
head = new_pixi( 7, 7, 1 )
hand = new_pixi( 9, 3, 1 )
foot = new_pixi( 11,5, 1 )
clear( )
//pole
fbox(-80,-120,160,250,SNEG)
print("clik - generate robot",-85,-132,SNEG)

start:

fbox(X+2,-153,40,15,RED)
fbox(X,-155,40,15,#dfdfff)

fbox(X+47,-153,40,15,RED)
fbox(X+45,-155,40,15,#dfdfff)
print("Body",X+50,-150,BLACK)

fbox(X+92,-153,40,15,RED)
fbox(X+90,-155,40,15,#dfdfff)
print("Hand",X+93,-150,BLACK)

fbox(X+137,-153,40,15,RED)
fbox(X+135,-155,40,15,#dfdfff)
print("Foot",X+138,-150,BLACK)

fbox(X+12,137,40,15,RED)
fbox(X+10,135,40,15,#dfdfff)
print("Save",X+13,140,BLACK)

fbox(X+132,137,40,15,RED)
fbox(X+130,135,40,15,#dfdfff)
print("Mix",X+133,140,BLACK)

//robots
pixi( foot, 0, 80, 12 )
fbox(-30,30,60,80,SNEG)
pixi( hand, 0, 0, 16 )
pixi( body, 0, 20, 16 )

handle_keys(
{
if gpr(X+45,-155,40,15) {Body}
if gpr(X+90,-155,40,15){Hand}
if gpr(X+135,-155,40,15){Foot}
if gpr(X+10,135,40,15){save}
}
,{pause_video_export}, {  } )

frame(0)
go start

Body:
set_screen( body )
xs = get_pixi_xsize( body )
ys = get_pixi_ysize( body )
y = 0 x = 0
yloop:
x = 0
xloop:
xx = x - xs / 2
yy = y - ys / 2
dot( xx, yy, #FFFFFF )
dot( -xx, yy, #FFFFFF )
dot( -xx, -yy, #FFFFFF )
dot( xx, -yy, #FFFFFF )
if rand & 1 {
dot( xx, yy, #101010 )
dot( -xx, yy, #101010 )
dot( -xx, -yy, #101010 )
dot( xx, -yy, #101010 )
}
x + 1
if x < xs { go xloop }
y + 1
if y < ys { go yloop }
set_screen( 0 )
ret

hy = 0 hx = 0
hyloop:
hx = 0
hxloop:
hxx = hx  - hxs/2
hyy = hy - hxs/2
dot( hx, hy, #FFFFFF )
dot( -hx, hy, #FFFFFF )
if rand & 1{
dot( hxx, hyy, #101010 )
dot( -hxx, hyy, #101010 )}
hx + 1
if hx < hxs { go hxloop }
hy + 1
if hy < hys { go hyloop }
set_screen( 0 )
ret

Hand:
set_screen( hand )
handxs = get_pixi_xsize( hand )
handys = get_pixi_ysize( hand )
handy = 0 handx = 0
handyloop:
handx = 0
handxloop:
handxx = handx - handxs / 2
handyy = handy - handys / 2
dot( handxx, handyy, #FFFFFF )
dot( -handxx, handyy, #FFFFFF )
dot( -handxx, -handyy, #FFFFFF )
dot( handxx, -handyy, #FFFFFF )
if rand & 1 {
dot( handxx, handyy, #101010 )
dot( -handxx, handyy, #101010 )
dot( -handxx, -handyy, #101010 )
dot( handxx,  -handyy, #101010 )
}
handx + 1
if handx < handxs { go handxloop }
handy + 1
if handy < handys { go handyloop }
set_screen( 0 )
ret

Foot:
set_screen( foot )
footxs = get_pixi_xsize( foot )
footys = get_pixi_ysize( foot )
footy = 0 footx = 0
footyloop:
footx = 0
footxloop:
footxx = footx - footxs / 2
footyy = footy - footys / 2
dot( footxx, footyy, #FFFFFF )
dot( -footxx, footyy, #FFFFFF )
dot( -footxx, -footyy, #FFFFFF )
dot( footxx, -footyy, #FFFFFF )
if rand & 1 {
dot( footxx, footyy, #101010 )
dot( -footxx, footyy, #101010 )
dot( -footxx, -footyy, #101010 )
dot( footxx, -footyy, #101010 )
}
footx + 1
if footx < footxs { go footxloop }
footy + 1
if footy < footys { go footyloop }
set_screen( 0 )
ret

save:
h = get_hours
m = get_minutes
s = get_seconds
if gpr(-100,135,40,15){
video_export_gif("robot.\$h.\$m.\$s.gif",-80,-120,160,250)}
ret

``````
Attachments
robots.gif (10.63 KiB) Viewed 10774 times
Last edited by goglus on Mon Jan 12, 2009 9:56 pm, edited 1 time in total.
Posts: 239
Joined: Tue Dec 04, 2007 2:33 pm
Location: Krasnodar
Contact:

### Re: Генератор роботов

На мой взгляд, вполне самодостаточный генератор роботов.
ВекторКодПиксельПолигон - ВотЧтоЯЛюблю!
vtl
Posts: 31
Joined: Sun Dec 28, 2008 6:41 pm
Location: Saint Petersburg, Russia
Contact:

### Re: Генератор роботов

прикольная штука
intre
Posts: 43
Joined: Sat Nov 08, 2008 6:28 pm
Location: Moscow
Contact:

### Re: Генератор роботов

Штука прикольная, только надо исправить сохранение в картинку.
goglus
Posts: 122
Joined: Tue Dec 04, 2007 4:19 pm
Contact:

### Re: Генератор роботов

пофиксил
goglus
Posts: 122
Joined: Tue Dec 04, 2007 4:19 pm
Contact:

### Re: Генератор роботов

ВЕРСИЯ 2

улучшил генератор ног и избавился от кнопок

Code: Select all

``````
//goglus generate robot pixilang (2009)

B=#101010
S=SNEG
a=RED
z=GREEN
o=ORANGE
n=BLUE

robobottom="
..aaaaaa
..a.aa.a
..aaaaaa
...aaaa
zzoooooozz
zzoooooozz
z.oooooo.z
..nnnnnn
..nnnnnn
..nn..nn
.nnn..nnn
"
make_pixi(robobottom)
r=#bfbfbf
savebottom="
..rrrrr..
..r.r.r..
..rrrrr..
...rrr...
..rrrrr
rrrrrrrrr
..rrrrr
...rrr..
..rrrrr
..rr.rr
.rrr.rrr
"

make_pixi(savebottom)
xz=777
yz=777
body = new_pixi( 5, 7, 1 )
head = new_pixi( 7, 7, 1 )
hand = new_pixi( 9, 3, 1 )
foot = new_pixi( 5,5, 1 )
clear(S)
print("MAKE",-65,142,B)
print("SAVE",35,142,#c5c5c5)
print("clik - generate robot",-85,-132,B)
start:
pixi(robobottom,-93,132,4,2)
pixi(savebottom,95,132,4,2)

//robots
pixi( foot, 0, 80, 12 )
pixi( hand, 0, 0, 16 )
pixi( body, 0, 20, 16 )

handle_keys(
{ a=-1 b=-1
x1=gpx+2 y1=gpy+2
color=get_dot(x1,y1)
if color=ORANGE {Body}
if color=GREEN {Hand}
if color=BLUE{Foot}
if color=#bfbfbf{tame
video_export_gif("robot.\$h.\$m.\$s.gif",-80,-120,160,245)}
if color=B {Head Foot Hand Body}
}, {pause_video_export }, {   } )

frame(0)
pause_video_export
go start

Body:
set_screen(body)
xs = get_pixi_xsize( body )
ys = get_pixi_ysize( body )
y = 0 x = 0
yloop:
x = 0
xloop:
xx = x - xs / 2
yy = y - ys / 2
dot( xx, yy, S )
dot( -xx, yy, S )
dot( -xx, -yy, S )
dot( xx, -yy, S )
if rand & 1 {
dot( xx, yy, B )
dot( -xx, yy, B )
dot( -xx, -yy, B )
dot( xx, -yy, B )}
x + 1
if x < xs { go xloop }
y + 1
if y < ys { go yloop }
set_screen( 0 )
ret

hy = 0 hx = 0
hyloop:
hx = 0
hxloop:
hxx = hx  - hxs/2
hyy = hy - hxs/2
dot( hx, hy, S )
dot( -hx, hy, S )
if rand & 1{
dot( hxx, hyy, B )
dot( -hxx, hyy, B )}
hx + 1
if hx < hxs { go hxloop }
hy + 1
if hy < hys { go hyloop }
set_screen( 0 )
ret

Hand:
set_screen( hand )
handxs = get_pixi_xsize( hand )
handys = get_pixi_ysize( hand )
handy = 0 handx = 0
handyloop:
handx = 0
handxloop:
handxx = handx - handxs / 2
handyy = handy - handys / 2
dot( handxx, handyy, S )
dot( -handxx, handyy, S )
dot( -handxx, -handyy, S )
dot( handxx, -handyy, S )
if rand & 1
{ dot( handxx, handyy, B )
dot( -handxx, handyy, B )
dot( -handxx, -handyy, B )
dot( handxx, -handyy, B )
}
handx + 1
if handx < handxs { go handxloop }
handy + 1
if handy < handys { go handyloop }
set_screen( 0 )
ret

Foot:
set_screen( foot )
footxs = get_pixi_xsize( foot )
footys = get_pixi_ysize( foot )
footy = 0 footx = 0
footyloop:
footx = 0
footxloop:
footxx = footx - footxs / 2
footyy = footy - footys / 2
dot( footxx, footyy, S )
dot( -footxx, footyy, S )
dot( -footxx, -footyy, S )
dot( footxx, -footyy, S )
if rand & 1
{
dot( footxx, footyy, B )
dot( -footxx, footyy, B )
dot( -footxx, -footyy, B )
dot( footxx, -footyy, B )
}
footx + 1
if footx < footxs {go footxloop}
footy + 1
if footy < footys {go footyloop}
set_screen( 0 )
ret

tame:
h = get_hours
m = get_minutes
s = get_seconds
ret

``````
Attachments
robots_gen.gif (3.97 KiB) Viewed 10685 times