SyntaxBoom

General Category => General Discussion => Topic started by: Dabzy on Jun 22, 2025, 10:46 AM

Title: Competition (1) - The Type-In Trial Submissions
Post by: Dabzy on Jun 22, 2025, 10:46 AM
Competition (1) - The Type-In Trial Submissions

All entries are in, they are below for people to play with.

Pick your two favourite Type-In examples from the poll above. The winner of our beautiful SyntaxBoom.com mug will be the one who receives the most votes from their fellow members.

You will find the poll here:

https://www.syntaxboom.com/forum/index.php?topic=149

Simple as that... Hopefully! :P

Winner will be unveiled 11th August 2025, so, a weeks worth of voting! :)

All entrants are invited to add an exectuable version to their type in for peeps who don't have required tools/languages installed.

Dabz

I've left my little snippet in, but I wont be entered and all that jazz.

Graphics3D 800,600,32,2
SetBuffer BackBuffer()
Global p=CreateCube(),c=CreateCamera(),lr=0,bul=0,et=0,s=0
ScaleEntity p,.5,.5,1
PositionEntity p,0,0,0
PositionEntity c,0,5,-10
RotateEntity c,30,0,0
Dim bu(100),en(100)
While Not KeyHit(1)
    If KeyDown(205) Then TurnEntity p,0,-2,0
    If KeyDown(203) Then TurnEntity p,0,2,0
    If KeyDown(57) And MilliSecs()-lr>200
        bu(bul)=CreateCube()
        ScaleEntity bu(bul),.1,.1,.5
        EntityColor bu(bul),0,0,255
        PositionEntity bu(bul),EntityX(p),EntityY(p),EntityZ(p)
        RotateEntity bu(bul),EntityPitch(p),EntityYaw(p),EntityRoll(p)
        bul=(bul+1) Mod 100
        lr=MilliSecs()
    EndIf
 
    For i=0 To 99
        If bu(i)<>0
            MoveEntity bu(i),0,0,1
            If EntityZ(bu(i))>50 Then FreeEntity bu(i):bu(i)=0
        EndIf
    Next
 
    et=et+1
 
    If et>30
        For i=0 To 99
            If en(i)=0
                en(i)=CreateCube()
                PositionEntity en(i),Rnd(-8,8),0,50
                ScaleEntity en(i),.5,.5,.5
                EntityColor en(i),255,0,0
                Exit
            EndIf
        Next
        et=0
    EndIf
 
    For i=0 To 99
        If en(i)<>0
            MoveEntity en(i),0,0,-.1
            If EntityZ(en(i))<EntityZ(p) Or EntityDistance(p,en(i))<1
                Repeat
                Cls
                Text 0,0,"Breached - Hits "+s
                Flip
                Until KeyDown(1)
            EndIf
     
            For j=0 To 99
                If bu(j)<>0 And en(i)<>0
                    If EntityDistance(bu(j),en(i))<1
                        FreeEntity en(i)
                        en(i)=0
                        FreeEntity bu(j)
                        bu(j)=0
                        s=s+1
                    EndIf
                EndIf
            Next
        EndIf
    Next
    RenderWorld
    Text 0,0,s+" hit"
    Flip
    Delay 1
Wend

Controls:

Left/Right Arrows - Rotate Turret
Space - Fire

Aim:

Keep the hordes of red blocks back by blasting them as they move forward

Once they breach your turrets position, its game over.
Title: Re: Competition (1) - The Type-In Trial
Post by: Matty on Jun 23, 2025, 05:50 AM
not sure it had to be a game, I think I read up the top somewhere it could be an "app" rather than a game...but I was planning on rebuilding something like this anyway so it was a fun challenge, here's an explosion generator in blitz3d:
It's 5089 characters give or take +-10.

AppTitle "Explosion Generator"
Global flt
Global smt
Global spt
Type flm
Field ag#
Field e
Field x#,y#,z#
Field sc#
Field ap#
Field tm#
End Type

Type smk
Field e
Field x#,y#,z#
Field sc#
Field ap#
Field tm#
Field ag#
End Type

Type spk
Field e
Field t
Field x#,y#,z#
Field vx#,vy#,vz#
Field ay#
Field sc#
Field ap#
Field tm#
End Type

Graphics3D 1024,1024,0,2
Global camera=CreateCamera()
MoveEntity camera,0,0,-128
tm#=0.0
frm=0

While Not(KeyHit(1))
frm=frm+1
frm=frm Mod 128
If frm=0 Then
For fl.flm=Each flm
FreeEntity fl\e
Delete fl
Next
For sm.smk=Each smk
FreeEntity sm\e
Delete sm
Next
For sp.spk=Each spk
FreeEntity sp\e
Delete sp
Next
flms=q(24,64)
smks=q(10,24)
spks=q(36,72)
For n=1 To flms
crflm()
Next
For n=1 To smks
crsmk()
Next
For n=1 To spks
crspk()
Next
EndIf
tm=Float(frm)
For fl.flm=Each flm
fl\tm=fl\tm+1.0
If fl\tm>0 Then
ShowEntity fl\e
PositionEntity fl\e,fl\x,fl\y,fl\z
fl\sc=fl\sc+2.75
fl\ap=fl\ap*0.8735
ses fl\e,fl\sc,fl\sc,fl\sc
RotateEntity fl\e,fl\ag,fl\ag,fl\ag
ea fl\e,min(fl\ap,1)
If tm > 118 Then ea fl\e,min(fl\ap,1)*(128.0-tm)/10.0
Else
HideEntity fl\e
EndIf
Next
For sm.smk=Each smk
sm\tm=sm\tm+1.0
If sm\tm>0 Then
ShowEntity sm\e
PositionEntity sm\e,sm\x,sm\y,sm\z
sm\sc=sm\sc+0.75
sm\ap=sm\ap*0.65
ses sm\e,sm\sc,sm\sc,sm\sc
ea sm\e,min(sm\ap,1)
If tm > 118 Then ea sm\e,min(sm\ap,1)*(128.0-tm)/10.0
Else
HideEntity sm\e
EndIf
Next
For sp.spk=Each spk
sp\tm=sp\tm+1.0
If sp\tm > 0 Then
ShowEntity sp\e
PositionEntity sp\e,sp\x,sp\y,sp\z
sp\x=sp\x+sp\vx*0.02
sp\y=sp\y+sp\vy*0.02
sp\z=sp\z+sp\vz*0.02
sp\vy=sp\vy+sp\ay*3.0
; sp\ap=sp\ap*0.9
ses sp\e,sp\sc*1.5,sp\sc*1.5,sp\sc*1.5
EntityTexture sp\e,sp\t
EntityBlend sp\e,3
ea sp\e,min(sp\ap,1)
If p(0,150)<14 And sp\t=spt Then crsmktrail(sp.spk)
If tm > 118 Then ea sp\e,min(sp\ap,1)*(128.0-tm)/10.0
Else
HideEntity sp\e
EndIf
Next
RenderWorld
Color 255,255,255
Text 0,0,frm
Flip True
Wend

Function crflm()
If flt=0 Then
flt=crt()
sb(flt)
For n=1 To 700
x=p(-128,384)
y=p(-128,384)
rr=p(200,255)+20
gg=p(100,180)+30
bb=p(20,120)+20
If n Mod 3 < 1 Then
rr=rr/3
gg=gg/3
bb=bb/3
EndIf
Color min(rr,255),min(gg,255),min(bb,255)
Oval x,y,24,24,1
Next
sb(0)
EndIf
fl.flm=New flm
fl\x=q(-24,24)
fl\y=q(-24,24)
If p(0,100)<35 Then
fl\x=q(-62,62)
fl\y=q(-62,62)
EndIf
If p(0,100)<22 Then
fl\x=q(-86,86)
fl\z=q(-86,86)
EndIf
If p(0,100)<1
fl\x=q(-122,122)
fl\y=q(-122,122)
EndIf
fl\x=fl\x*0.8
fl\y=fl\y*0.8
fl\z=q(96,162)+32
fl\sc=q(0.15,3.0)
fl\ap=1.5
fl\tm=q(-12,0)
fl\e=csp()
EntityTexture fl\e,flt
EntityBlend fl\e,3
sms fl\e,q(0.5,1.5),q(0.5,1.5),q(0.5,1.5)
fl\ag=q(0,360)
End Function

Function crspk()
If spt=0 Then
spt=crt()
sb(spt)
For n=1 To 1
x=p(124,125)
y=p(124,125)
rr=255
gg=220
bb=180
Color rr,gg,bb
Oval x,y,8,8,1
Next
sb(0)
EndIf
fl.spk=New spk
fl\x=q(-16,16)
fl\y=q(-16,16)
fl\z=q(96,192)+32
fl\sc=q(1,10)
fl\ap=4.5
fl\vx=q(-12,12)*10.0
fl\vy=q(-12,16)*10.0
fl\vz=q(-12,12)*10.0
fl\ay=-0.7
fl\tm=q(-40,-8)
fl\e=csp()
fl\t=spt
End Function

Function crsmktrail(sp.spk)
fl.spk=New spk
fl\x=sp\x
fl\y=sp\y
fl\z=sp\z
fl\sc=sp\sc*0.25
fl\ap=sp\ap*0.5
fl\vx=sp\vx*0.4
fl\vy=sp\vy*0.4
fl\vz=sp\vz*0.4
fl\ay=-0.7
fl\tm=1
fl\e=csp()
fl\t=smt
End Function

Function crsmk()
If smt=0 Then
smt=crt()
sb(smt)
For n=1 To 500
x=p(-128,384)
y=p(-128,384)
rr=p(10,64)/2
gg=rr
bb=rr
If n Mod 3 < 2 Then
rr=rr/2
gg=gg/2
bb=bb/2
EndIf
Color rr,gg,bb
Oval x,y,48,48,1
Next
sb(0)
EndIf
fl.smk=New smk
fl\x=q(-64,64)
fl\y=q(-64,64)
If p(0,100)<6 Then
fl\x=q(-92,92)
fl\y=q(-92,92)
EndIf
fl\x=fl\x*0.8
fl\y=fl\y*0.8
fl\z=q(96,192)+32
fl\sc=q(5,20)+q(5,20)+q(5,20)
fl\ap=16.25-q(0,10)
fl\tm=q(-44,-8)
fl\e=csp()
EntityTexture fl\e,smt
EntityBlend fl\e,3
sms fl\e,q(0.3,1.1),q(0.3,1.1),q(0.3,1.1)
fl\ag=q(0,360)
End Function

Function min#(a#,b#)
If a < b Then Return a Else Return b
End Function

Function max#(a#,b#)
If a > b Then Return a Else Return b
End Function

Function sms(ent,x#,y#,z#)
ScaleMesh ent,x,y,z
End Function

Function ses(ent,x#,y#,z#)
ScaleEntity ent,x,y,z
End Function

Function crt()
w=256
Return CreateTexture(w,w,1)
End Function

Function csp()
Return CreateSphere()
End Function

Function sb(t)
If t=0 Then SetBuffer BackBuffer() Else SetBuffer TextureBuffer(t)
End Function

Function ea(ent,a#)
EntityAlpha ent,a
End Function

Function q#(a#,b#)
Return Rnd(a,b)
End Function

Function p(a,b)
Return Rand(a,b)
End Function
Title: Re: Competition (1) - The Type-In Trial
Post by: Naughty Alien on Jun 23, 2025, 09:54 AM
..lil FPS thingy, Ursina engine.. ;D

import ursina
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
from ursina.shaders import lit_with_shadows_shader
from direct.filter.CommonFilters import CommonFilters

app = Ursina()


window.color=color.azure

random.seed(0)
Entity.default_shader = lit_with_shadows_shader

ground = Entity(model='plane', collider='box', scale=256,color=color.olive)

editor_camera = EditorCamera(enabled=False, ignore_paused=True)
player = FirstPersonController(model='cube', z=-10, color=color.orange, origin_y=-.5, speed=8, collider='box')
player.collider = BoxCollider(player, Vec3(0,1,0), Vec3(1,2,1))

gun = Entity(model='cube', parent=camera, position=(.5,-.25,.25), scale=(.3,.2,1), origin_z=-.5, color=color.red, on_cooldown=False)
gun.muzzle_flash = Entity(parent=gun, z=1, world_scale=.5, model='quad', color=color.yellow, enabled=False)

shootables_parent = Entity()
mouse.traverse_target = shootables_parent


#walls
for i in range(127):
    Entity(model='cube', origin_y=-.5, scale=2,
           position=(127,0,(i*2)-127),
           collider='box',
           scale_y=random.uniform(3, 6),
           color=color.gray
           #color=color.hsv(0, 0, random.uniform(.9, 1))
           )
    Entity(model='cube', origin_y=-.5, scale=2,
           position=((i * 2) - 127, 0, 127),
           collider='box',
           scale_y=random.uniform(3, 6),
           color=color.gray
           #color=color.hsv(0, 0, random.uniform(.9, 1))
           )
    Entity(model='cube', origin_y=-.5, scale=2,
           position=(-127,0,(i*2)-127),
           collider='box',
           scale_y=random.uniform(3, 6),
           color=color.gray
           #color=color.hsv(0, 0, random.uniform(.9, 1))
           )
    Entity(model='cube', origin_y=-.5, scale=2,
           position=((i*2)-127, 0, -127),
           collider='box',
           scale_y=random.uniform(3, 6),
           color=color.gray
           #color=color.hsv(0, 0, random.uniform(.9, 1))
           )
#Obstacles
for i in range(100):
    Entity(model='cube', origin_y=-.5, scale=2,
        x=random.uniform(-i,i),
        z=random.uniform(-i,i) + 8,
        collider='box',
        scale_y = random.uniform(2,5),
        color=color.gold
        )

def update():
    if held_keys['left mouse']:
        shoot()


def shoot():
    if not gun.on_cooldown:
        # print('shoot')
        gun.on_cooldown = True
        gun.muzzle_flash.enabled=True
        from ursina.prefabs.ursfx import ursfx
        ursfx([(0.0, 0.0), (0.1, 0.9), (0.15, 0.75), (0.3, 0.14), (0.6, 0.0)], volume=0.5, wave='noise', pitch=random.uniform(-13,-12), pitch_change=-12, speed=3.0)
        invoke(gun.muzzle_flash.disable, delay=.05)
        invoke(setattr, gun, 'on_cooldown', False, delay=.15)
        if mouse.hovered_entity and hasattr(mouse.hovered_entity, 'hp'):
            mouse.hovered_entity.hp -= 10
            mouse.hovered_entity.blink(color.red)


from ursina.prefabs.health_bar import HealthBar

class Enemy(Entity):
    def __init__(self, **kwargs):
        super().__init__(parent=shootables_parent, model='cube', scale_y=2, origin_y=-.5, color=color.light_gray, collider='box', **kwargs)
        self.health_bar = Entity(parent=self, y=1.2, model='cube', color=color.red, world_scale=(1.5,.1,.1))
        self.max_hp = 100
        self.hp = self.max_hp



    def update(self):
        dist = distance_xz(player.position, self.position)
        if dist > 40:
            return

        self.health_bar.alpha = max(0, self.health_bar.alpha - time.dt)


        self.look_at_2d(player.position, 'y')
        hit_info = raycast(self.world_position + Vec3(0,1,0), self.forward, 30, ignore=(self,))
        # print(hit_info.entity)
        if hit_info.entity == player:
            if dist > 2:
                self.position += self.forward * time.dt * 5

    @property
    def hp(self):
        return self._hp

    @hp.setter
    def hp(self, value):
        self._hp = value
        if value <= 0:
            destroy(self)
            return

        self.health_bar.world_scale_x = self.hp / self.max_hp * 1.5
        self.health_bar.alpha = 1

# Enemy()
enemies = [Enemy(x=x*8) for x in range(10)]


def pause_input(key):
    if key == 'escape': application.quit()
    if key == 'tab':    # press tab to toggle edit/play mode
        editor_camera.enabled = not editor_camera.enabled

        player.visible_self = editor_camera.enabled
        player.cursor.enabled = not editor_camera.enabled
        gun.enabled = not editor_camera.enabled
        mouse.locked = not editor_camera.enabled
        editor_camera.position = player.position

        application.paused = editor_camera.enabled

pause_handler = Entity(ignore_paused=True, input=pause_input)

filters = CommonFilters(application.base.win, application.base.cam)
filters.set_cartoon_ink(separation=1,color=(0,0,0,1))

sun = DirectionalLight()
sun.shadow_map_resolution = (8192, 8192)
sun.look_at(Vec3(1,-1,-1))


app.run()




(https://i.postimg.cc/VkCKZpZQ/Shot.png)
Title: Re: Competition (1) - The Type-In Trial
Post by: Matty on Jun 23, 2025, 07:54 PM
Here's one more "a flyover of a landscape with lightning and clouds"

Blitz3d. Under 4k characters/bytes in code size:

;Landscape And Lightning
;change these three lines if you need to
Const screenwidth = 1920
Const screenheight = 1080
Const windowed = 2
Global gt
Global ct
Global lt
Global he
Global ce
Global le

Type hl
Field x#,y#,z#,sx#,sy#,sz#
End Type

Type cl
Field x#,y#,z#,sx#,sy#,sz#
End Type

Type lg
Field x#,y#,z#,sx#,sy#,sz#,dx#,dy#,dz#
End Type

Graphics3D screenwidth,screenheight,0,windowed
Global camera = CreateCamera()
CameraFogMode camera,1
CameraFogRange camera,50,750
lt = CreateTexture(16,64,1+2)
gt = CreateTexture(256,256,1)
ct = CreateTexture(256,256,1+2)
he = CreateSphere()
he he
ce = CreateSphere()
he ce
le = CreateCube()
ScaleMesh le,0.1,0.1,1
PositionMesh le,0,0,1
he le
SetBuffer TextureBuffer(gt)
For n = 1 To 10000
x = Rand(-128,384)
y = Rand(-128,384)
rr = Rand(50,120)-25
gg = Rand(100,200)-50
bb = Rand(60,90)-35
Color rr,gg,bb
Oval x,y,16,16,1
Next
SetBuffer TextureBuffer(ct)
For n = 1 To 10000
x = Rand(-128,384)
y = Rand(-128,384)
rr = Rand(60,140)
gg = rr+50
bb = rr+80
Color rr,gg,bb
Oval x,y,16,16,1
Next
SetBuffer TextureBuffer(lt)
Color 50,125,255
Rect 0,0,32,64,1
SetBuffer BackBuffer()
For n = 1 To 1500
h.hl = New hl
h\x = q(-512,512) * 4.0
h\y = 0
h\z = q(-512,512) * 4.0
h\sx = q(64.0,192.0)
h\sy = q(4.0,16.0)*1.5
h\sz = q(64.0,192.0)
Next
For n = 1 To 7500
c.cl = New cl
c\x = q(-512,512) * 4.0
c\y = q(64.0,96.0)+24
c\z = q(-512,512) * 4.0
c\sx = q(32.0,64.0)
c\sy = q(8.0,16.0)*2
c\sz = q(32.0,64.0)
Next
EntityTexture le,lt
EntityBlend le,3
EntityAlpha le,0.65
EntityTexture he,gt
EntityTexture ce,ct
EntityAlpha ce,0.05
cmx# = 0
cmy# = 40.0
cmz# = 0
cdx# = 0
cdy# = 0
cdz# = 1
CameraClsColor camera,80,100,120
CameraFogColor camera,80,100,120
plane = CreatePlane()
l1 = CreateLight(1)
l2 = CreateLight(1)
l3 = CreateLight(1)
l4 = CreateLight(1)
AlignToVector l1,-1,-1,-1,3,1
AlignToVector l2,-1,1,1,3,1
AlignToVector l3,1,1,-1,3,1
AlignToVector l4,1,1,1,3,1
AmbientLight 0,0,0
fr = 0
tm# = 0
cmy = 25.0
While Not(KeyHit(1))
tm = tm + 0.25
fr = fr + 1
fr = fr Mod 16
If fr Mod 4 = 0 Then
For n = 1 To 6
crl(q(-1500,1500),q(80,90),q(-1500,1500))
Next
EndIf
If fr = 0 Then Delete Each lg
cmx = cmx + cdx
cmy = cmy + cdy
cmz = cmz + cdz
cdx = 3.0 * Sin(tm)
cdz = 3.0 * Cos(tm)
cdy = 0.125 * Sin(tm*1.5)
PositionEntity camera,cmx,cmy,cmz
AlignToVector camera,cdx,cdy,cdz,3,1
Cls
CameraClsMode camera,True,True
ScaleTexture gt,1,1
EntityTexture plane,gt
se plane
RenderWorld
he plane
CameraClsMode camera,False,False
se he
ScaleTexture gt,0.00525,0.00525
For h.hl = Each hl
PositionEntity he,h\x,h\y,h\z
ScaleEntity he,h\sx,h\sy,h\sz
RenderWorld
Next
he he
se ce
ScaleTexture ct,0.1,0.1
PositionTexture ct,tm*0.25,tm*0.5
For c.cl = Each cl
PositionEntity ce,c\x,c\y,c\z
ScaleEntity ce,c\sx,c\sy,c\sz
RenderWorld
Next
he ce
se le
For l.lg = Each lg
PositionEntity le,l\x,l\y,l\z
AlignToVector le,l\dx,l\dy,l\dz,3,1
ScaleEntity le,l\sx,l\sy,l\sz
RenderWorld
Next
he le
Flip True
Wend

Function crl(lx#,ly#,lz#)
While ly > -10
l.lg = New lg
l\x = lx
l\y = ly
l\z = lz
l\sx = 1
l\sy = 1
l\sz = q(4,16)
l\dx = q(-0.75,0.75)*l\sz
l\dz = q(-0.75,0.75)*l\sz
l\dy = q(-2,-1)*l\sz
lx = l\x + l\dx
lz = l\z + l\dz
ly = l\y + l\dy
Wend
End Function

Function p(a,b)
Return Rand(a,b)
End Function

Function q#(a#,b#)
Return Rnd(a,b)
End Function

Function se(e)
ShowEntity e
End Function

Function he(e)
HideEntity e
End Function
Title: Re: Competition (1) - The Type-In Trial
Post by: Matty on Jun 23, 2025, 09:56 PM
Here's another code snippet: A tree maker in Blitz3D. Code Length About 4k characters.

;Tree Maker
;change these three lines if you need to
Const screenwidth=1920
Const screenheight=1080
Const windowed=2
;can adjust this one too if you want
Const maxleaf = 2500

Global barktex
Global leaftex
Global branchent
Global leafent

Type branch
Field x#,y#,z#,pitch#,yaw#,roll#,length#,thickness#
End Type

Type leaf
Field x#,y#,z#,dx#,dy#,dz#,s#
End Type

Graphics3D screenwidth,screenheight,0,windowed
Global camera = CreateCamera()
pivot = CreatePivot()
MoveEntity camera,0,90,-90
PointEntity camera,pivot
EntityParent camera,pivot
barktex = CreateTexture(256,256,1)
branchtex = barktex
leaftex = CreateTexture(256,256,1+2)
SetBuffer TextureBuffer(barktex)
For n = 1 To 10000
x = Rand(-128,384)
y = Rand(-128,384)
rr = Rand(80,160)
gg = Rand(40,100)
bb = Rand(20,80)
Color rr,gg,bb
Oval x,y,48,48,1
Next
SetBuffer TextureBuffer(leaftex)
For n = 1 To 10000
x = Rand(-128,384)
y = Rand(-128,384)
rr = Rand(60,120)
gg = Rand(120,200)
bb = Rand(40,100)
Color rr,gg,bb
Oval x,y,48,48,1
Next
SetBuffer BackBuffer()

branchent = CreateCylinder(3)
ScaleMesh branchent,0.125,0.5,0.125
PositionMesh branchent,0,0.5,0
HideEntity branchent
leafent = CreateCone(3)
ScaleMesh leafent,1,1,0.005
HideEntity leafent
EntityTexture branchent,branchtex
EntityTexture leafent,leaftex

seed = 1
frame = 0
l1 = CreateLight(1)
AlignToVector l1,-1,-1,-1,3,1
l2 = CreateLight(1)
AlignToVector l2,1,-1,1,3,1

AmbientLight 0,0,0
cube = CreateCube()
ScaleMesh cube,6,1,6
MoveEntity cube,0,5,0
EntityColor cube,10,10,10
While Not(KeyHit(1))
frame = frame + 1
frame = frame Mod 64
stime = Abs(MilliSecs() - ctime)
TurnEntity pivot,0,1,0
If frame = 0 Or stime > 3000 Then
.redotree
ctime = MilliSecs()
seed = MilliSecs()
SeedRnd seed
seed = Rand(1,10000)
SeedRnd seed
Delete Each branch
Delete Each leaf
createtree(0,0,0)
b.branch = First branch
Delete b
Repeat
leafcount = 0
For l.leaf = Each leaf
leafcount = leafcount + 1
Next
If leafcount>=maxleaf Then
index = 0
For l.leaf = Each leaf
index = index + 1
If index Mod 10 = 0 Then Delete l
Next
EndIf
Until leafcount < maxleaf
If leafcount < 1000 Then Goto redotree
EndIf
Cls
CameraClsMode camera,True,True
ShowEntity cube
RenderWorld
HideEntity cube
CameraClsMode camera,False,False
ShowEntity branchent
For b.branch = Each branch
PositionEntity branchent,b\x,b\y,b\z
RotateEntity branchent,b\pitch,b\yaw,b\roll
ScaleEntity branchent,b\thickness,b\length,b\thickness
RenderWorld
Next
HideEntity branchent
ShowEntity leafent
For l.leaf = Each leaf
PositionEntity leafent,l\x,l\y,l\z
RotateEntity leafent,l\dx,l\dy,l\dz
ScaleEntity leafent,l\s,l\s,l\s
RenderWorld
Next
HideEntity leafent
Color 255,255,255
Text 0,0,"Seed:"+seed
Flip True
Wend
End

Function createtree(x#,y#,z#,ll#=0,maxll#=20.0,delta#=0)
If delta <>0 Then doleaves = 10
If ll = 0 Then ll = Rand(3,9)
pivot = CreatePivot()
For n = 1 To ll
If n > 2 Then
For m = 1 To 6
If Rand(0,10)<6 Then
createtree(x,y,z,ll/2,maxll/2,Rand(-90,90))
EndIf
Next
EndIf
b.branch = New branch
b\x = x
b\y = y
b\z = z
aa = Rnd(-12*n,12*n)+delta
bb = Rnd(-12*n,12*n)+delta
cc = Rnd(-12*n,12*n)+delta
delta = 0
PositionEntity pivot,x,y,z
TurnEntity pivot,aa,bb,cc
b\pitch = EntityPitch(pivot)
b\yaw = EntityYaw(pivot)
b\roll = EntityRoll(pivot)
length# = Rnd(0.1,0.5)*Float(maxll-n)
MoveEntity pivot,0,length,0
x = EntityX(pivot)
y = EntityY(pivot)
z = EntityZ(pivot)
b\length = length
b\thickness = length * 0.5
leafnum = Rand(2,doleaves/(maxll/2))
For leaves = 1 To leafnum
aa = Rnd(0,360)
bb = Rnd(0,360)
s# = Rnd(0.1,0.6)
dx# = Rnd(0,360)
dy# = Rnd(0,360)
dz# = Rnd(0,360)
dd# = Rnd(2,5)/(ll*2)
xx# = x + dd * Sin(aa)
yy# = y + dd * Cos(aa)
zz# = z + dd * Sin(bb)
l.leaf = New leaf
l\x = xx
l\y = yy
l\z = zz
l\dx = dx
l\dy = dy
l\dz = dz
l\s = s
Next
Next

FreeEntity pivot
End Function
Title: Re: Competition (1) - The Type-In Trial
Post by: mrmediamanx on Jun 25, 2025, 04:17 PM
AppTitle "PIXELMAN_SLIM_EDITION [MRMEDIAMANXl 2025] BLITZ3D"
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
Global GRAV#=.01,JUMPVEL#=.3,HEALTH=100,SCORE=0,BESTSCORE=0,KILLS=0,NME_HEALTH=10,START=0,HURTTIMER=0
Global PLY=CreateCube() PositionEntity PLY,-0,-1,0:EntityColor PLY,0,128,0:EntityType PLY,1
Global STG=CreateCube() PositionEntity STG,0,8,0:ScaleEntity STG,50,10,50:EntityColor STG,0,0,255:EntityAlpha STG,0.5:FlipMesh STG:EntityType STG,2
Global NME=CreateCube() PositionEntity NME,Rnd(-30,30),-1,Rnd(-30,30):EntityColor NME,255,0,0:EntityType NME,1
Global CAM=CreateCamera(),LITE=CreateLight():EntityParent CAM,PLY:PositionEntity CAM,EntityX(PLY),EntityY(PLY)+5,EntityZ(PLY)-10
Global TEX=CreateTexture(32,32,1+8):SetBuffer TextureBuffer(TEX):Color 0,0,0:Rect 0,0,32,32,1:Color 0,0,255:Rect 0,0,32,32,0:SetBuffer BackBuffer():Color 255,255,255:ScaleTexture TEX,0.1,0.2
Collisions 1,2,2,2:EntityTexture STG,TEX
Type SHTTYPE Field ENTITY,MOVE#,TIMER# End Type:Global HITTIMER=0;CREATE_SHOT
Function ADDSHOT(X#,Y#,Z#)
SHT.SHTTYPE=New SHTTYPE:SHT\ENTITY=CreateSprite()
PositionEntity SHT\ENTITY,EntityX(PLY),EntityY(PLY),EntityZ(PLY)
RotateEntity SHT\ENTITY,0,EntityYaw(PLY),0
ScaleSprite SHT\ENTITY,0.1,0.1
EntityColor SHT\ENTITY,255,255,128
SHT\MOVE#=1
SHT\TIMER#=300
End Function
Function UPDATESHOT();UPDATE_SHOT
For SHT.SHTTYPE=Each SHTTYPE
MoveEntity SHT\ENTITY,0,0,SHT\MOVE#
If (MilliSecs()/10 Mod 5) And (HITTIMER>0) Then EntityColor NME,252,215,3 Else EntityColor NME,255,0,0;HIT
If (SHT\TIMER#>0) Then SHT\TIMER#=SHT\TIMER#-1
If (SHT\TIMER#=0) Then SCORE=SCORE+1:FreeEntity SHT\ENTITY:Delete SHT:Return
If (NME_HEALTH>0 And EntityDistance(SHT\ENTITY,NME)<4) Then NME_HEALTH=NME_HEALTH-1:SCORE=SCORE+5:HITTIMER=10:FreeEntity SHT\ENTITY:Delete SHT:Return
If (NME_HEALTH=0) Then PositionEntity NME,Rnd(-50,50),-1,Rnd(-50,50):NME_HEALTH=10:KILLS=KILLS+1:SCORE=SCORE+150
Next
End Function
While Not KeyDown(1)
If START=0 And KeyHit(28) Then START=1
If START=1 And HEALTH>0 Then
PointEntity CAM,PLY
PointEntity NME,PLY
MoveEntity NME,0,0,0.3
If KeyDown(203) TurnEntity PLY,0,1,0 ElseIf KeyDown(205) TurnEntity PLY,0,-1,0
If KeyDown(200) SPED#=SPED#+0.3 ElseIf KeyDown(208) SPED#=SPED#-0.3
If JUMP=0 Then If KeyDown(44) YVEL#=JUMPVEL# JUMP=1
If JUMP=1 YVEL#=YVEL#-GRAV# BY#=BY#+YVEL#
If BY#<1 Then BY#=1YVEL#=0 JUMP=0
SPED#=SPED#*0.5
If HURTTIMER>0 Then HURTTIMER=HURTTIMER-1
If HITTIMER>0 Then HITTIMER=HITTIMER-1
If HEALTH>0 And EntityDistance(NME,PLY)<4 And HURTTIMER=0) Then MoveEntity PLY,0,0,-0.5:HEALTH=HEALTH-1:HURTTIMER=50
If HURTTIMER>0 And (MilliSecs()/10 Mod 5) Then EntityAlpha PLY,0 Else EntityAlpha PLY,1
MoveEntity PLY,0,YVEL#,SPED#
If KeyHit(45) Then ADDSHOT(EntityX(PLY),EntityY(PLY),EntityZ(PLY))
EndIf
UpdateWorld:UPDATESHOT():RenderWorld
If START=0 Text 350,200,"PRESS_ENTER TO START"
Text 10,10,"HEALTH:"+HEALTH:Text 10,25,"SCORE:"+SCORE:Text 10,40,"KILLS:"+KILLS
Text 350,10,"BEST SCORE:"+BESTSCORE
If SCORE>BESTSCORE Then BESTSCORE=SCORE
If HEALTH=0 And START=1 Then Text 350,200,"-GAMEOVER-":Text 320,220,"*ENTER KEY - RETRY*":Text 350,240,"*ESC - QUIT*"
If KeyDown(28) And HEALTH=0 Then HEALTH=100:SCORE=0:KILLS=0:NME_HEALTH=10:HURTTIMER=0:PositionEntity PLY,-0,-1,0:PositionEntity NME,Rnd(-30,30),-1,Rnd(-30,30):START=0
Flip
Wend:End

Here we go, PIXELMAN SLIM EDITION ... I checked the character count this time using the site and it came in at 58 lines,9 columns and 3026 characters [without spaces] with room still to spare. had to do a quick patch for the shot code, added a few extra touch ups ;D
disregard the last one.

Controls Arrow keys - move
Z - jump
X - shoot
Enter key - select
escape key - close game

How to play
Shoot the red guys for points and don't die.
go for a best score then try to beat it.

V-0.1:
Added enemy hit color change
Added player hurt blinking and hurt timer.
Title: Re: Competition (1) - The Type-In Trial
Post by: RemiD on Jul 04, 2025, 09:38 AM
here is a code (blitzbasic (blitz3d)) to count the number of chars in a text file, without considering the space chars.
Graphics( 640, 360, 32, 2 )

filename$ = "dabz-code.txt"
charscount% = 0
fileH% = ReadFile( filename ) : DebugLog( fileH )
If( fileH <> 0 )
 While Not Eof( fileH )
  linestr$ = ReadLine( fileH ) ;: DebugLog( linestr )
  If( Len( linestr ) > 0 )
   For c% = 1 To Len( linestr ) Step+1
    charstr$ = Mid( linestr, c, 1 )
    If( charstr <> " " )
     charscount = charscount + 1
    EndIf
   Next
  EndIf
 Wend
EndIf
CloseFile( fileH ) : fileH = 0

DebugLog( charscount )

WaitKey()

End()

this seems to work...
Title: Re: Competition (1) - The Type-In Trial
Post by: Qube on Jul 18, 2025, 05:03 PM
My entry..
QUBEOIDS!!!

AGK

Code (basic) Select
// Asteroids game

#renderer "Advanced"

SetWindowTitle("Qubeoids")
SetWindowSize(1024,768,0)
SetVirtualResolution(1024,768)
SetSyncRate(60,0)
UseNewDefaultFonts(1)

type tS
x as float
y as float
a as float
vx as float
vy as float
t as integer
endtype

type tR
s as integer
x as float
y as float
vx as float
vy as float
z as integer
a as integer
endtype

type tB
s as integer
x as float
y as float
vx as float
vy as float
l as integer
endtype

global sh as tS
global dim r[20] as tR
global dim b[10] as tB
global sc as integer
global lv as integer
global go as integer

sh.x=512
sh.y=384
sh.a=0
lv=3
sc=0
go=0

ss=CreateSprite(0)
SetSpriteSize(ss,30,30)
SetSpriteColor(ss,0,0,255,255)

for i=0 to 19
r[i].s=CreateSprite(0)
SetSpriteColor(r[i].s,200,200,200,255)
SetSpriteShape(r[i].s,1)
r[i].a=0
next i

for i=0 to 9
b[i].s=CreateSprite(0)
SetSpriteSize(b[i].s,6,6)
SetSpriteColor(b[i].s,255,255,0,255)
SetSpriteVisible(b[i].s,0)
next i

for i=0 to 4
SR(i,3)
next i

while not GetRawKeyPressed(27)
if go=0
if GetRawKeyState(37) then sh.a=sh.a-4
if GetRawKeyState(39) then sh.a=sh.a+4

if GetRawKeyState(38)
sh.vx=sh.vx+cos(sh.a)*0.3
sh.vy=sh.vy+sin(sh.a)*0.3
sh.t=1
else
sh.t=0
endif

if GetRawKeyPressed(32) then FB()

sh.x=sh.x+sh.vx
sh.y=sh.y+sh.vy
sh.vx=sh.vx*0.99
sh.vy=sh.vy*0.99

if sh.x<0 then sh.x=1024
if sh.x>1024 then sh.x=0
if sh.y<0 then sh.y=768
if sh.y>768 then sh.y=0

SetSpritePosition(ss,sh.x-15,sh.y-15)
SetSpriteAngle(ss,sh.a)

for i=0 to 19
if r[i].a=1
r[i].x=r[i].x+r[i].vx
r[i].y=r[i].y+r[i].vy

if r[i].x<-50 then r[i].x=1074
if r[i].x>1074 then r[i].x=-50
if r[i].y<-50 then r[i].y=818
if r[i].y>818 then r[i].y=-50

SetSpritePosition(r[i].s,r[i].x-r[i].z*10,r[i].y-r[i].z*10)

d=sqrt((sh.x-r[i].x)^2+(sh.y-r[i].y)^2)
if d<r[i].z*10+15
lv=lv-1
sh.x=512
sh.y=384
sh.vx=0
sh.vy=0
if lv<=0 then go=1
endif
endif
next i

for i=0 to 9
if b[i].l>0
b[i].x=b[i].x+b[i].vx
b[i].y=b[i].y+b[i].vy
b[i].l=b[i].l-1

if b[i].x<0 or b[i].x>1024 or b[i].y<0 or b[i].y>768
b[i].l=0
endif

if b[i].l>0
SetSpritePosition(b[i].s,b[i].x-3,b[i].y-3)
SetSpriteVisible(b[i].s,1)
for j=0 to 19
if r[j].a=1
d=sqrt((b[i].x-r[j].x)^2+(b[i].y-r[j].y)^2)
if d<r[j].z*10
b[i].l=0
SetSpriteVisible(b[i].s,0)
BR(j)
exit
endif
endif
next j
else
SetSpriteVisible(b[i].s,0)
endif
endif
next i

rc=0
for i=0 to 19
if r[i].a=1 then inc rc
next i
if rc=0
for i=0 to 4
SR(i,3)
next i
endif
else
if GetRawKeyPressed(13)
lv=3
sc=0
go=0
sh.x=512
sh.y=384
sh.vx=0
sh.vy=0
for i=0 to 19
r[i].a=0
SetSpriteVisible(r[i].s,0)
next i
for i=0 to 4
SR(i,3)
next i
endif
endif

Print("Score: "+str(sc))
Print("Lives: "+str(lv))
if go=1
Print("")
Print("GAME OVER!")
Print("Press ENTER to restart")
endif

Sync()
endwhile

function SR(idx,sz)
r[idx].z=sz
r[idx].x=random(0,1024)
r[idx].y=random(0,768)
r[idx].vx=(random(0,40)-20)/10.0
r[idx].vy=(random(0,40)-20)/10.0
r[idx].a=1
SetSpriteSize(r[idx].s,sz*20,sz*20)
SetSpriteVisible(r[idx].s,1)
endfunction

function FB()
for i=0 to 9
if b[i].l=0
b[i].x=sh.x
b[i].y=sh.y
b[i].vx=cos(sh.a)*10+sh.vx
b[i].vy=sin(sh.a)*10+sh.vy
b[i].l=60
exit
endif
next i
endfunction

function BR(idx)
sc=sc+(4-r[idx].z)*100
if r[idx].z>1
for i=0 to 19
if r[i].a=0
r[i].z=r[idx].z-1
r[i].x=r[idx].x
r[i].y=r[idx].y
r[i].vx=(random(0,40)-20)/10.0
r[i].vy=(random(0,40)-20)/10.0
r[i].a=1
SetSpriteSize(r[i].s,r[i].z*20,r[i].z*20)
SetSpriteVisible(r[i].s,1)
exit
endif
next i
for i=0 to 19
if r[i].a=0
r[i].z=r[idx].z-1
r[i].x=r[idx].x
r[i].y=r[idx].y
r[i].vx=(random(0,40)-20)/10.0
r[i].vy=(random(0,40)-20)/10.0
r[i].a=1
SetSpriteSize(r[i].s,r[i].z*20,r[i].z*20)
SetSpriteVisible(r[i].s,1)
exit
endif
next i
endif
r[idx].a=0
SetSpriteVisible(r[idx].s,0)
endfunction