Main Menu

News:

SyntaxBoom, now with pwetty syntax highlighted code boxes! \o/ 

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

Shoutbox

Jackdaw

Today at 22:07:30
Well you learn something new every day. There is a fork of Blender 3D called Bforartists, that has a much better GUI than Blender's own. You'll find the link to it in the new github page in found in https://www.syntaxboom.com/forum/index.php?topic=25.0

Baggey

2025-09-24, 17:57:11
They'll be using Expanding foam to glue bricks together next  :-X

Dabzy

2025-09-24, 06:09:52
You can also get the expanding foam post fix, but, I wouldnt trust it really, especially where I live on the side of a valley and when the storms blow in the right direction, whistling down the valley, nowt is safe!

Baggey

2025-09-23, 08:53:01
That Postcrete stuff is amazing. I never know how much water to add. May be i should read the Instructions  ;D 

Dabzy

2025-09-22, 21:33:46
Cannot beat a breaky uppy mode, saves the hand cramps and chipped knuckles knocking ten bells out of a chod of conc with a hammer and chisel.

GfK

2025-09-22, 21:28:44
I have a massive JCB drill with a concrete breaky uppy mode which has got me out of jail free a couple of times replacing rotted fence posts that has been concreted in.

Amon

2025-09-22, 19:23:30
What about Roly?

Dabzy

2025-09-22, 19:22:35
Putting my 2 deckings in.... I've dug enough post holes to last me a life time... I feel sorry for the future poor sod who may want to shift'em... Like most things I do, I tend to go over the top, and as such, I've probably got shares in postcrete! :D

GfK

2025-09-22, 19:10:57
Round is a shape.

Baggey

2025-09-22, 19:04:49
Consult a qualified electrician for compliance with BS 7671 and local building Regs! Avoid areas where future digging is likely. ;)

Members
  • Total Members: 55
  • Latest: Amon
Stats
  • Total Posts: 1,608
  • Total Topics: 198
  • Online today: 13
  • Online ever: 54 (Sep 14, 2025, 08:48 AM)
Users Online
  • Users: 0
  • Guests: 6
  • Total: 6
Welcome to SyntaxBoom. Please login or sign up.

Recent

Turrent Shooter

Started by Dabzy, Jun 22, 2025, 06:08 PM

Previous topic - Next topic

Dabzy

Pretty much my little Competition (1) example but I've inflated the variable identifiers in the code to what they represent, instead of the one character ones which I used to save space.

Graphics3D 800,600,32,2

SetBuffer BackBuffer()
SeedRnd MilliSecs()

Global player=CreateCube()
ScaleEntity player,.5,.5,1
PositionEntity player,0,0,0

Global camera=CreateCamera()
PositionEntity camera,0,5,-10
RotateEntity camera,30,0,0

Dim bullets(100),enemies(100)
Global bulletIndex=0,enemySpawnCounter=0,score=0, lastShotTime=0

While Not KeyHit(1)
    If KeyDown(205) Then TurnEntity player,0,-2,0 
    If KeyDown(203) Then TurnEntity player,0,2,0 
    If KeyDown(57) And MilliSecs()-lastShotTime>200 
        bullets(bulletIndex)=CreateCube() 
        ScaleEntity bullets(bulletIndex),.1,.1,.5 
        EntityColor bullets(bulletIndex),0,0,255  
        PositionEntity bullets(bulletIndex),EntityX(player),EntityY(player),EntityZ(player)
        RotateEntity bullets(bulletIndex),EntityPitch(player),EntityYaw(player),EntityRoll(player)
        bulletIndex=(bulletIndex+1) Mod 100
        lastShotTime=MilliSecs()
    EndIf
 
    For i=0 To 99
        If bullets(i)<>0
            MoveEntity bullets(i),0,0,1
            If EntityZ(bullets(i))>50 Then FreeEntity bullets(i):bullets(i)=0
        EndIf
    Next
 
    enemySpawnCounter=enemySpawnCounter+1
 
    If enemySpawnCounter>30
        For i=0 To 99
            If enemies(i)=0
                enemies(i)=CreateCube()
                PositionEntity enemies(i),Rnd(-8,8),0,50
                ScaleEntity enemies(i),.5,.5,.5
                EntityColor enemies(i),255,0,0
                Exit
            EndIf
        Next
        enemySpawnCounter=0
    EndIf
    
    For i=0 To 99
        If enemies(i)<>0
            MoveEntity enemies(i),0,0,-.1
            If EntityZ(enemies(i))<EntityZ(player) Or EntityDistance(player,enemies(i))<1
            Repeat 
				Cls
                Text 0,0,"Breached - Hits "+s
                Flip
				Until KeyDown(1)
            EndIf 
        
            For j=0 To 99
                If bullets(j)<>0 And enemies(i)<>0
                    If EntityDistance(bullets(j),enemies(i))<1
                        FreeEntity enemies(i)
                        enemies(i)=0
                        FreeEntity bullets(j)
                        bullets(j)=0
                        score=score+1
                    EndIf
                EndIf
            Next
        EndIf
    Next
    RenderWorld
    Text 0,0,score+" hit"
    Flip
delay 1
Wend

Left/Right arrows to rotate turret, space to fire at the onslaught of red cubes, once a red cube goes past the turret... Game over!

Dabz
Intel i7-13620H, nVidia GerForce RTX 4060 Laptop GPU (8GB GDDR6), 16GB LPDDR5X, 1TB SSD, Windows 11 x64 piss flap of an OS!