Game
Wikiwiki
6 years ago

WIKIWIKI #GAMEJAAJ EDITION - CÓDIGO-FONTE (CÓDIGO SPAGHETTI, COISA DE PROGRAMADOR GORDO)


indexfonts()

global recall_ang as integer
global score as double integer
global has_goal as boolean
global gx as dword
global gy as dword
global goal_dist as integer
global goal_x as integer
global goal_y as integer
global map_x as integer
global map_y as integer
global seed as double integer
global prev as byte
global width as integer
global height as integer
global fc as integer
global delay as integer
global lp as integer
global speed as float
global acel as float
global maxspeed as float
global rows as integer
global columns as integer

type ambient
x# as float
y# as float
endtype

environ as ambient

AUTOCAM OFF
SYNC ON : SYNC RATE 60

dx = desktop width()
dy = desktop height()
dd = 32
set window layout 0,0,0
set display mode dx,dy,dd
maximize window

jump:

delall()
titlescreen()

map_x = rnd(2000000000)
map_y = rnd(2000000000)
DO
set text size 100
seed = (map_x + 2000000000) + map_y
RANDOMIZE seed

f$ = font(rnd(fq-1)+1)
set text font f$

ROWS = 25 + rnd(75)
COLUMNS= 25 + rnd(75)
MAKEMAP(ROWS,COLUMNS)

skybox(99999,100000)
COLOR BACKDROP 0

set global collision on

speed = 1.5

fc = 0 : delay = 5
lp = 0
prev = 0
REPEAT
inc fc
if object collision(10,0) < 100 then inc score

if object collision(10,0) = 0
move object 10,speed
if (leftkey() = 1 or rightkey() = 1) and fc > lp + delay
if leftkey() = 1 then yrotate object 10,wrapvalue(object angle y(10)-90)
if rightkey() = 1 then yrotate object 10,wrapvalue(object angle y(10)+90)
lp = fc
endif
else
col = object collision(10,0)

if col >= 100
set text size 100
center text screen width()/2,screen height()/2,”GAME OVER”
endif

if col = 9 : hide object 9 : has_goal = 0 : score = score (2+goal_dist) : endif
if col = 11 : prev = 1 : score = score 1.25 : endif
if col = 12 : prev = 2 : score = score 1.25 : endif
if col = 13 : prev = 3 : score = score 1.25 : endif
if col = 14 : prev = 4 : score = score * 1.25 : endif
endif
movesky(99999,100000)

SYNC
UNTIL prev > 0 or spacekey() = 1
clear camera view 0
if spacekey() = 1 then goto jump
if prev = 1 then map_x = wrap(map_x-1,0,2000000000)
if prev = 2 then map_x = wrap(map_x+1,0,2000000000)
if prev = 3 then map_x = wrap(map_y-1,0,2000000000)
if prev = 4 then map_x = wrap(map_y+1,0,2000000000)
if prev > 0 then recall_ang = object angle y(10) else recall_ang = 0

LOOP

FUNCTION BLOCK(N,WIDTH,HEIGHT,W,H,C1,C2,C3)
IF IMAGE EXIST(N) = 1 THEN DELETE IMAGE N
CREATE BITMAP N,W,H

CLS C1
SX = RND(W/2)+1 : SY = RND(H/2)+1
SZ = RND(9)+1
LOCK PIXELS
FOR X = 0 TO W STEP SX
FOR Y = 0 TO H STEP SY
SZ = RND(4)+1
VX = 0 : VY = 0
R = RND(2)
IF R > 0
NX = X : NY = Y
REPEAT
VX = VX + (RND(1)-RND(1))
VY = VY + (RND(1)-RND(1))
NX = WRAP(NX+VX,0,W) : NY = WRAP(NY+VY,0,H)
IF R = 1 THEN DOT NX,NY,C2
IF R = 2 THEN DOT NX,NY,C3
DEC SZ,1
UNTIL SZ = 0
ENDIF
NEXT
NEXT
UNLOCK PIXELS

GET IMAGE N,0,0,W,H,1 : DELETE BITMAP N

IF OBJECT EXIST(N) = 1 THEN DELETE OBJECT N

MAKE OBJECT BOX N,WIDTH,HEIGHT,WIDTH
TEXTURE OBJECT N,N

SCALE OBJECT TEXTURE N,RND(3)^2,RND(3)^2
SET OBJECT TEXTURE N,RND(2),1
SET OBJECT FILTER N,RND(2)
SET OBJECT TRANSPARENCY N,0
set object cull n,1

set object diffuse n,c1
set object specular n,c2
set object specular power n,rnd(255)

POSITION OBJECT N,0,-1000000,0
HIDE OBJECT N
ENDFUNCTION

FUNCTION MAKEMAP(ROWS,COLUMNS)
DIM MAP(ROWS,COLUMNS) AS BYTE

		
			   WIDTH = RND(40)+20
   HEIGHT= RND(50)+20
		
	

FOR N = 1 TO 2
W = RND(28)+2
H = RND(28)+2
C1 = RGB(RND(254)+1,RND(254)+1,RND(254)+1)
C2 = RGB(RND(254)+1,RND(254)+1,RND(254)+1)
C3 = RGB(RND(254)+1,RND(254)+1,RND(254)+1)
BLOCK(N,WIDTH,HEIGHT,W,H,C1,C2,C3)
NEXT
WALL = 2
GROUND=1

SZ = (ROWS*COLUMNS)
X = RND(ROWS-4)+2
Y = RND(COLUMNS-4)+2

MAP(X,Y) = 1

ST = RND(7)
MD = RND(4)+1
Mx = RND(4)+1
My = RND(4)+1
REPEAT

		
			   IF ST = 0 THEN D = RND(3)
   IF ST = 1 AND (X + Y) MOD MD = 0 THEN D = RND(3)
   IF ST = 2 AND (X * Y) MOD MD = 0 THEN D = RND(3)
   IF ST = 3 AND (X MOD MD = 0 OR Y MOD MD = 0) THEN D = RND(3)
   IF ST = 4 AND SZ MOD MD = 0 THEN D = RND(3)
   if st = 5 and x <> y then d = rnd(3)
   if st = 6 and x = y then d = rnd(3)
   if st = 7 and (x mod mx = 0 or y mod my = 0) then d = rnd(3)

   IF D = 0 : VX = 1 : VY = 0 : ENDIF
   IF D = 1 : VX =-1 : VY = 0 : ENDIF
   IF D = 2 : VX = 0 : VY = 1 : ENDIF
   IF D = 3 : VX = 0 : VY =-1 : ENDIF
		
	

X = CROP(X+VX,2,ROWS-2)
Y = CROP(Y+VY,2,COLUMNS-2)

MAP(X,Y) = 1
DEC SZ,1
UNTIL SZ = 0

FOR X = 2 TO ROWS-1
FOR Y = 2 TO COLUMNS-1

		
			   IF MAP(X,Y) = 1
   FOR NX = X-1 TO X+1
   FOR NY = Y-1 TO Y+1
          IF MAP(NX,NY) = 0 THEN MAP(NX,NY) = 2
   NEXT       
   NEXT
   ENDIF
NEXT
		
	

NEXT

C = 100
FOR X = 1 TO ROWS
FOR Y = 1 TO COLUMNS

		
			   IF MAP(X,Y) = 1 : INSTANCE OBJECT C,GROUND : set object collision off c : endif
   IF MAP(X,Y) = 2 THEN INSTANCE OBJECT C,WALL
   IF MAP(X,Y) > 0
   if map(x,y) = 1 then py = -(height/2) else py = height/2
   POSITION OBJECT C,X*WIDTH,py,Y*WIDTH
   INC C
   ENDIF
   NEXT
		
	

NEXT
REPEAT
X = RND(ROWS-1)+1
Z = RND(COLUMNS-1)+1
UNTIL MAP(X,Z) = 1
if object exist(10) = 1 then delete object 10
make object cube 10,2

set alpha mapping on 10,0

map(x,z) = 3
setgates()

position object 10,xwidth,height/2,zwidth
turn object right 10,rnd(3)*90

		
			   setupgoal()

   UNDIM MAP(0)

   fog on
   fog color c1
   fog distance width*rnd(15)+5
   set camera range 0,1,2800
   set camera fov 0,90
		
	

ENDFUNCTION

FUNCTION CROP(V,F,T)
IF V > T THEN V = T
IF V < F THEN V = F
ENDFUNCTION V

function skybox(n1,n2)
if image exist(n1) = 1 then delete image n1
if image exist(n2) = 1 then delete image n2

		
			   w = rnd(80)+20 : h = rnd(80)+20
   scatter = rnd(15)+5
   size = rnd(100)+10
   color = rgb(rnd(254)+1,rnd(254)+1,rnd(254)+1)
   create bitmap n1,w,h
   for c = 1 to scatter
   x = rnd(w) : y = rnd(h)
   sz = size
   repeat
   vx = rnd(1)-rnd(1) : vy = rnd(1)-rnd(1)
   x = wrap(x+vx,0,w)       
   y = wrap(y+vy,0,h)
   dot x,y,color
   dec sz,1
   UNTIL sz = 0
   NEXT
   get image n1,0,0,w,h,1 : delete bitmap n1

   if object exist(n1) = 1 then delete object n1
   make object sphere n1,-2500
   texture object n1,n1
   set object transparency n1,2
   set object filter n1,2
   set object fog n1,0
   set object light n1,0

   environ.x# = (rnd(20) - rnd(20))*0.0001
   environ.y# = (rnd(20) - rnd(20))*0.0001

   create bitmap n2,10,100
   c0 = rgb(0,0,0)
   c1 = rgb(rnd(255),rnd(255),rnd(255)) 
   c2 = rgb(rnd(255),rnd(255),rnd(255))
   h1 = rnd(100) : h2 = rnd(100-h1)
   box 0,0,10,h1,c0,c1,c0,c1
   box 0,h1,10,100-h2,c1,c2,c1,c2
   box 0,100-h2,10,100,c2
   get image n2,0,0,10,100,1 : delete bitmap n2

   if object exist(n2) = 1 then delete object n2
   make object sphere n2,-2700
   texture object n2,n2
   set object light n2,0
   set object texture n2,2,1
   scale object texture n2,1,2
   set object collision off n1
   set object collision off n2
		
	

ENDFUNCTION

function movesky(n1,n2)
for g = 11 to 14 : scroll object texture g,0.01,0.01 : set object to camera orientation g : next
scroll object texture n1,environ.x#,environ.y#
ox = object position x(10)
oz = object position z(10)
oy = 5
set camera to follow 0,ox,oy,oz,object angle y(10),2,0,5,1
find_goal()
position object n1,ox,oy,oz
position object n2,ox,oy,oz
center text screen width()/2,0,str$(score)

ENDFUNCTION

function gate(n,color)
if image exist(n) = 1 then delete image n
if object exist(n) = 1 then delete object n
create bitmap n,10,10
sx = rnd(1)+1
sy = rnd(1)+1
v = rnd(2)
for x = 0 to 10 step sx
for y = 0 to 10 step sy
if rnd(v) = 0 then dot x,y,color
next
NEXT
get image n,0,0,10,10,1 : delete bitmap n
make object sphere n,height

		
			   texture object n,n
   set object light n,0
   set object filter n,2
   set object texture n,2,1
   scale object texture n,rnd(2)+1^2,rnd(3)^2
   scale object n,100,3,100
   automatic object collision n,height,1
   set object collision to boxes n
   set object fog n,0
   set object cull n,0
   xrotate object n,90 : fix object pivot n
   scale object n,100,2,100 
		
	

ENDFUNCTION

function setgates()
g1 = 11 : c1 = rgb(255,0,0)
g2 = 12 : c2 = rgb(0,255,0)
g3 = 13 : c3 = rgb(255,255,0)
g4 = 14 : c4 = rgb(0,0,255)
gate(g1,c1)
gate(g2,c2)
gate(g3,c3)
gate(g4,c4)

		
			   if prev = 1 then out = 2
   if prev = 2 then out = 1
   if prev = 3 then out = 4
   if prev = 4 then out = 3

   for g = 1 to 4
   repeat
   x = rnd(rows-4)+2
   y = rnd(columns-4)+2
   until map(x,y) = 1
   map(x,y) = g+10
   position object g+10,x*width,height/2,y*width
   if g = out 
   position object g+10,0,-1000000,0
   position object 10,x*width,height/2,y*width
   yrotate object 10,recall_ang
   endif
   NEXT
		
	

ENDFUNCTION

function setupgoal()
if has_goal = 0
goal_dist = goal_dist + 1
gx = rnd(goal_dist) - rnd(goal_dist)
gy = rnd(goal_dist) - rnd(goal_dist)

goal_x = wrap(map_x + gx,0,2000000000)
goal_y = wrap(map_y + gy,0,2000000000)

has_goal = 1
endif
if has_goal = 1 then goalstone()

ENDFUNCTION

function find_goal()
dist_x = goal_x - map_x
dist_y = goal_y - map_y
if dist_x = 0 and dist_y = 0
if has_goal = 1 then center text screen width()/2,screen height()-100,”Cristal detectado!”
if has_goal = 0 then center text screen width()/2,screen height()-100,”Pegou cristal!”
else
center text screen width()/2,screen height()-100,”Dist: (“+ str$(dist_x) + “,” + str$(dist_y) + “)”
ENDIF
ENDFUNCTION

function goalstone()
if map_x = goal_x AND map_y = goal_y
if image exist(9) = 1 then delete image 9
if object exist(9) = 1 then delete object 9
create bitmap 9,10,10
cor = rgb(rnd(1)255,rnd(1)255,rnd(1)*255)
cls cor
box outline 0,0,10,10,rgb(255,255,255)
get image 9,0,0,10,10,1
delete bitmap 9

make object sphere 9,20,6,3
texture object 9,9
set object light 9,0
repeat
x = rnd(rows-4)+2
y = rnd(columns-4)+2
until map(x,y) = 1
map(x,y) = 4
position object 9,xwidth,height/2,ywidth
else
if image exist(9) = 1 then delete image 9
if object exist(9) = 1 then delete object 9
endif
ENDFUNCTION

function indexfonts()
global fq as integer
perform checklist for fonts
fq = checklist quantity()

		
			   dim font(fq) as string
   for f = 1 to fq
   font(f) = checklist string$(f)       
   NEXT
		
	

ENDFUNCTION

function titlescreen()
color backdrop 0
f1$ = font(rnd(fq-1)+1)
f2$ = font(rnd(fq-1)+1)
f3$ = font(rnd(fq-1)+1)

set text size 100
t1$ = “Wikiwiki”
t2$ = “#gamejaaj

set text font f1$ : t2i(1,t1$) : lock object on 1
set text font f2$ : t2i(2,t2$) : lock object on 2

position object 1,0,50,200
position object 2,0,-50,300
set text font f3$
repeat

yrotate object 1,wrapvalue(object angle y(1)+0.5)

set text size 30
text 0,0,”Programado por Rheys Mertani”
text 0,screen height()-200,”100% refeito para competir na #gamejaaj do Amdre Young”
text 0,screen height()-160,”Espere MUITOS bugs!”
text 0,screen height()-120,”Tudo aqui é procedural.”
text 0,screen height()-80,”A história do jogo está no leia-me.txt anexo!”
text 0,screen height()-40,”Pressione ENTER para jogar”

sync
until returnkey() = 1
randomize timer()
ENDFUNCTION

function t2i(n,t$)
if image exist(n) = 1 then delete image n
w = text width(t$)
h = text height(t$)
create bitmap n,w,h
text 0,0,t$
get image n,0,0,w,h,1
delete bitmap n

		
			   if object exist(n) = 1 then delete object n
   make object plane n,w,h
   texture object n,n
   set object transparency n,1
   set object light n,0
   set object filter n,0
		
	

ENDFUNCTION

function delall()
for x = 1 to 100000
if object exist(x) = 1 then delete object x
NEXT
ENDFUNCTION



0 comments

Loading...

Next up

Short intro of us 💕✌️

We're an eletro duo based in Seoul 🇰🇷 Heavily influenced by the 90s.

Our new album #Xennials is all about the nostalgia of that era 💽 CD listenin 📟 beeper beepin 💾 floppy disks floppin days 😎

Stream now! 🎧

https://open.spotify.com/album/3YwWhnHWVy5cA8XOpbaGRA?si=8E9awqU…

So

i may or may not make an full art of some person or i may just leave this like that-

🍒Did you like the game? A demo is available for free on Steam.

✌️ Thanks for playing IndieGameiacs!

⚙️ Free Demo: http://bit.ly/UniDuni

📺 Full Video: https://youtu.be/5qEbVXg7GaQ

#steam #uniduni #clops #screenshotsaturday

Path of Kami: The Evolution of the Lore

Shadow The Hedgehog X pixel art

Updated the chest in the maze, adding sound, particles and better animation. But what's in the chest?

Family band complete!

A Shiny Mega Gengar 🌟 For @ManutkArt 's #ThreeColorsChallenge!

One of the most critical update for Sunblaze demo. Now you are able to pet a cat! Finally!

Spaaaace~

These are background sprites I've created for a game I'm working on at school ^w^ Click on the post to see how the sprites connect. You won't regret it! (personally, I think it's pretty heheh)

Drawn in Piskel using my mouse. Whaddya think?