Whats up TRON? - FULL GAME

Advanced game related topics
User avatar
minimy
Addict
Addict
Posts: 874
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Whats up TRON? - FULL GAME

Post by minimy »

DEMO GAME - Whats up TRON?
A full game for free. - ¿Qué pasa TRON?

This has been moved from the Game Test v0.01 thread to this new thread by popular vote. :lol:

Image

LICENSE:

Code: Select all

Warning:  
This work is licensed under the Creative Commons Attribution‑NonCommercial‑ShareAlike (CC BY‑NC‑SA) license.
Commercial distribution, resale, or any form of monetization is strictly prohibited. You may use, share, and modify the material.
If you wish to use this material for commercial purposes, you must request and obtain a commercial license from the author.
More than 150 downloads and not a single thank you. It seems we have an education problem or something else.
I will share code again when the attitude changes.
Code removed.
If translation=Error: reply="Sorry, Im Spanish": Endif
User avatar
minimy
Addict
Addict
Posts: 874
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: Whats up TRON? - FULL GAME

Post by minimy »

Re-post.
for those who appreciate it, let it be shared...

Code: Select all

InitSound()
#SampleRate = 44100
#Bits       = 16
#Channels   = 1
Procedure tambores()
  totalSeconds = 12
  samplesTotal = totalSeconds * #SampleRate
  dataSize     = samplesTotal * 2
  wavSize      = 44 + dataSize
  *wav  = AllocateMemory(wavSize)
  *data = *wav + 44
  PokeL(*wav + 0,  $46464952)
  PokeL(*wav + 4,  wavSize - 8)
  PokeL(*wav + 8,  $45564157)
  PokeL(*wav + 12, $20746D66)
  PokeL(*wav + 16, 16)
  PokeW(*wav + 20, 1)
  PokeW(*wav + 22, #Channels)
  PokeL(*wav + 24, #SampleRate)
  PokeL(*wav + 28, #SampleRate * 2)
  PokeW(*wav + 32, 2)
  PokeW(*wav + 34, #Bits)
  PokeL(*wav + 36, $61746164)
  PokeL(*wav + 40, dataSize)
  beatEvery = #SampleRate / 8 
  kickDur   = 0.15 * #SampleRate
  snareDur  = 0.12 * #SampleRate
  For i = 0 To samplesTotal - 1
    If i < (#SampleRate * 5)
      octave = 1.0
    ElseIf i < (#SampleRate * 6)
      s = 0
      PokeW(*data + i * 2, s)
      Continue
    ElseIf i < (#SampleRate * 11)
      octave = 2.0
    Else
      s = 0
      PokeW(*data + i * 2, s)
      Continue
    EndIf
    pos = i % beatEvery
    If pos < kickDur
      t.d = pos / #SampleRate
      freq.d = (180 - t * 150) * octave
      env.d  = Exp(-t * 12)
      s = Sin(2 * #PI * freq * t) * env * 30000
    ElseIf pos < (kickDur + snareDur)
      t.d = (pos - kickDur) / #SampleRate
      env.d = Exp(-t * 20)
      noise = (Random(65535) - 32768)
      s = noise * env * 0.5
    Else
      s = 0
    EndIf
    PokeW(*data + i * 2, s)
  Next
  If CatchSound(0, *wav, wavSize)
    SetSoundFrequency(0,34100)
    PlaySound(0,#PB_Sound_Loop)
  EndIf
EndProcedure

Global font=  LoadFont(#PB_Any,"Segoe UI Emoji",30)
Global fontb=  LoadFont(#PB_Any,"Segoe UI Emoji",15,#PB_Font_Bold)
Global lives= 5, enemys=5, mateMarca, tt3dMarca,tt3dMarca2, bill
Global enemymesh, mme

Global Player
Global msg.s= "Whats up TRON?"
Global modo.b= 0
Global timer, ronda, record= 10000

Global NewList npcs.i()
Global NewMap bbb.i()

Procedure   drawMenu()
  Protected.s t
  Static x= 1000, ink
  If x%20=0
    ink= RGBA(Random(100)+155,Random(100)+155,Random(100)+155,255)
  EndIf
    StartDrawing(CanvasOutput(0))
      DrawingMode(#PB_2DDrawing_AlphaBlend)
      w=OutputWidth():h=OutputHeight()
      Box(0,0,w,h,$ff000000)
      DrawingFont(FontID(fontb))
      DrawText((w-TextWidth("Whats up TRON? or ¿Qué pasa TRON? - [Space to play]"))/2,-5,"Whats up TRON? or ¿Qué pasa TRON? - [Space to play]",$ff88ffaa)
      DrawText(x,20,msg,ink)
      x-2:If x<-TextWidth(msg):x=w:EndIf
    StopDrawing()
EndProcedure
Procedure   drawMarcador()
  Protected.s t
    StartDrawing(CanvasOutput(0))
      DrawingMode(#PB_2DDrawing_AlphaBlend)
      w=OutputWidth():h=OutputHeight()
      Box(0,0,w,h,$ff000000)
      DrawingFont(FontID(font))
      DrawText(10,-5,"🤖 Lives: "+Str(lives),$ff33ff33)
      t= "👾: Enemys:"+Str(enemys)
      DrawText(w-(TextWidth(t)+10),-5,t,$ff3333ff)
      DrawText((w-TextWidth(msg))/2,0,msg,$ff00ffff)
    StopDrawing()
EndProcedure
Procedure   drawGameOver()
  Protected.s t
    StartDrawing(CanvasOutput(0))
      DrawingMode(#PB_2DDrawing_AlphaBlend)
      w=OutputWidth():h=OutputHeight()
      Box(0,0,w,h,$ff000000)
      DrawingFont(FontID(font))
      t= "GAME OVER - Score:"+Str(timer)+"   Record:"+Str(record)+" - Space play again"
      DrawText((w-TextWidth(t))/2,-5,t,RGBA(Random(255),Random(255),Random(255),255))
      For p= 1 To 5
        Circle(Random(w-1),Random(h-1),Random(3,1),RGBA(Random(255),Random(255),Random(255),255))
      Next p
    StopDrawing()
EndProcedure

Procedure   npc(enti)

  Protected.f dx, dy, dz             ; vector hacia el player
  Protected.f dist                   ; distancia real
  Protected.f nx, ny, nz             ; vector normalizado
  Protected.f desiredDist = 0       ; distancia mínima
  Protected.f force = 8.0            ; fuerza de movimiento
  Protected.f fx, fy, fz             ; fuerza final
  Static kk
  
  ForEach npcs()
  
    ; VECTOR HACIA EL PLAYER
    dx = EntityX(enti) - EntityX(npcs()): dy = EntityY(enti) - EntityY(npcs()): dz = EntityZ(enti) - EntityZ(npcs())
    ; DISTANCIA
    dist = Sqr(dx*dx + dy*dy + dz*dz)
    ; NORMALIZAR
    If dist > 0
      nx = dx / dist: ny = dy / dist: nz = dz / dist
    EndIf
     ; MANTENER DISTANCIA
    If dist > desiredDist
      fx = nx * force: fy = ny * force: fz = nz * force
    Else
      fx = 0: fy = 0: fz = 0
    EndIf
    ; APLICAR FUERZA
    ApplyEntityForce(npcs(), fx, fy, fz)
    EntityAngularFactor(npcs(), 0, 0, 0)
    
    If FindMapElement(bbb(),Str(npcs()))
      BillboardLocate(bbb(),bill, EntityX(npcs()),EntityY(npcs()),EntityZ(npcs()))
    EndIf
    
    If EntityY(npcs()) < 0
      If FindMapElement(bbb(),Str(npcs()))
        RemoveBillboard(bbb(),bill)
        DeleteMapElement(bbb(),Str(npcs()))
      EndIf
      FreeEntity(npcs())
      DeleteElement(npcs())
      enemys - 1
      If ListSize(npcs()) =< 1
        ronda +1
        
        For p= 1 To 5+ronda
          AddElement(npcs())
          npcs()=  CreateEntity(#PB_Any,MeshID(enemymesh),MaterialID(mme),Random(900)-450,Random(50,10),Random(900)-450)
          CreateEntityBody(npcs(),#PB_Entity_SphereBody,1,1,0.7)
          bbb(Str(npcs()))=AddBillboard(bill,0,10,0):ResizeBillboard(bbb(),bill,24,24)
        Next p
      EndIf
    EndIf
      
  Next
EndProcedure

Procedure   gameover()
  
EndProcedure
Procedure   dead()
  If EntityY(player)<0
    lives - 1
    If lives = 0
      modo= 2
      If timer > record : record= timer: EndIf
      gameover()
    Else
      DisableEntityBody(player,1)
      MoveEntity(player,0,10,0,#PB_Absolute)
      DisableEntityBody(player,0)
    EndIf
  EndIf
EndProcedure

  ;{ Básico 3D
  InitEngine3D(#PB_Engine3D_NoLog):InitSprite():InitKeyboard():InitMouse()
  OpenWindow(0,0,20,1280,720,"Whats up TRON",#PB_Window_SystemMenu|#PB_Window_Invisible)
  SetWindowColor(0,0)
  OpenWindowedScreen(WindowID(0),0,50,WindowWidth(0),WindowHeight(0)-50, 0,0,0,#PB_Screen_SmartSynchronization)
  CanvasGadget(0,0,0,WindowWidth(0),50)
  drawMarcador()
  y.f= (100 / WindowHeight(0)) * 50
  h.f= 100 - y
  CreateCamera(0, 0,0,100,h)
  CreateCamera(1, 0,0,100,h)
  CameraBackColor(0,$777777)
  CreateLight(0, $ffffff, 400,400,400, #PB_Light_Directional)
  LightDirection(0, 0.25,-0.85,-0.15)
  ;}
  
  ;{ cielo
  tsky= CreateTexture(#PB_Any,2000,1000)
  StartDrawing(TextureOutput(tsky))
    w=OutputWidth():h=OutputHeight()
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Box(0,0,w,h,$ff442211)
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Gradient)
    LinearGradient(0,0,0,h)
    BackColor($ff000000):GradientColor(0.2, $ff330000):GradientColor(0.3, $ffaa2200):GradientColor(0.4, $ffaa0000):GradientColor(0.5, $ff0044ff):FrontColor($ff000000)
    Box(0,0,w,h)
    ResetGradientColors()
    
    BackColor($ff999999):GradientColor(0.7, $ff999999):FrontColor($006666ff)
    x=900:y=410:r=40:CircularGradient(x,y,r): Circle(x,y,r)
    BackColor($ffaaaaaa):GradientColor(0.7, $ffaaaaaa):FrontColor($006666ff)
    x+10:y-10:r=50:CircularGradient(x,y,r): Circle(x,y,r)
    ResetGradientColors()
    
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    Circle(x+10,y-20,10,$11000000)
    Circle(x+8,y-18,10,$11ffffff)
    Circle(x-10,y-20,5,$11000000)
    Circle(x-8,y-18,5,$11ffffff)
    
    For p= 0 To 1000
      Plot(Random(w-1),Random(h-1),RGBA(Random(100)+155,Random(100)+155,Random(100)+155,255))
      Circle(Random(w),Random(h),Random(2,1)/2,RGBA(Random(100)+155,Random(100)+155,Random(100)+155,255))
    Next p
    
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Gradient)
    BackColor($ffffffff):GradientColor(0.7, $aaffffff):FrontColor($00ffffff)
    y=420: For p= 0 To w: r= Random(20,5):If Random(10)>8:Continue:EndIf:If Random(10)>8: CircularGradient(p,y,r): Circle(p,y,r):EndIf: Next p
    BackColor($558888ff):GradientColor(0.7, $558888ff):FrontColor($008888ff)
    y=430: For p= 0 To w: r= Random(20,5):If Random(10)>8:Continue:EndIf:If Random(10)>8: CircularGradient(p,y,r): Circle(p,y,r):EndIf: Next p
    BackColor($336666ff):GradientColor(0.7, $336666ff):FrontColor($006666ff)
    y=440: For p= 0 To w: r= Random(20,5):If Random(10)>8:Continue:EndIf:If Random(10)>8: CircularGradient(p,y,r): Circle(p,y,r):EndIf: Next p
    
    ; ;     y=200: For p= 0 To w Step 2: r= Random(30,20): CircularGradient(p,y,r): Circle(p,y,r): Next p
    ResetGradientColors()
    
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Gradient)
    BackColor($ff665544):GradientColor(0.7, $ff443322):FrontColor($00ffffff)
    CircularGradient(0,430,40)
    Circle(0,430,40,$ff443322)
    Circle(-3,427,40,$ff665544)
    
    CircularGradient(2000,430,40)
    Circle(2000,430,40,$ff443322)
    Circle(1997,427,40,$ff665544)
    DrawingMode(#PB_2DDrawing_AlphaBlend)
    For p= 0 To 200
      a.f= Radian(Random(360))
      l= Random(35)
      x= Cos(a) * l
      y= 430+ Sin(a) * l
      If x<0:x=1999+x:EndIf
;       Plot(x,y,$ff00ffff)
;       Plot(x+1,y-1,$ff000000)
    Next p
    Circle(1980,427,10,$11000000)
    Circle(1982,429,10,$11ffffff)
    Circle(1981,428,10,$ff554433)
    
  StopDrawing()
  msky= CreateMaterial(#PB_Any,TextureID(tsky));,$442211)
  MaterialFilteringMode(msky,#PB_Material_Anisotropic,8)
  MaterialCullingMode(msky,#PB_Material_AntiClockWiseCull)
  sky=  CreateEntity(#PB_Any,MeshID(CreateSphere(#PB_Any,1200,16,8)),MaterialID(msky))
  EntityRenderMode(sky,#PB_Shadow_None)
  ;}
  
  ;{ suelo reflexion
  Dim t2(9): Dim t2ID(9)
  For p= 0 To 9
    t2(p)=     CreateTexture(#PB_Any,300,300)
    StartDrawing(TextureOutput(t2(p)))
      w=OutputWidth():h=OutputHeight()
      DrawingMode(#PB_2DDrawing_AlphaBlend)
      Box(0,0,w,h,$ff888888)
      Box(10,10,w-20,h-20,$ff000000)
      ClipOutput(10,10,w-20,h-20)
        For n=1 To 50
          Box(Random(w),Random(h),Random(20),5,RGBA(Random(255),Random(255,155),Random(100),255))
        Next n
        Box(80,300-(p*30),20,20,$ff00ffff)
        Box(200,p*30,20,20,$ff00ffff)
      UnclipOutput()
    StopDrawing()
    t2ID(p)=TextureID(t2(p))
  Next p
  
  tcam=   CreateRenderTexture(#PB_Any,CameraID(1),1280,720,#PB_Texture_AutomaticUpdate)
  mateS=  CreateAnimatedMaterial(#PB_Any,t2ID(),3)
  AddMaterialLayer(mateS,TextureID(tcam),#PB_Material_AddSigned)
  SetMaterialAttribute(mateS, #PB_Material_ProjectiveTexturing, 1,1)
  ScaleMaterial(mateS,0.1,0.1,0)
  MaterialFilteringMode(mateS,#PB_Material_Anisotropic,8)
  suelo=    CreateEntity(#PB_Any, MeshID(CreatePlane(#PB_Any,1000,1000,1,1,4,4)), MaterialID(mateS),0,0,0)
  ;}
  
  ;{ objetos servidores
  Dim t1(9): Dim t1ID(9)
  For p= 0 To 9
    t1(p)=     CreateTexture(#PB_Any,300,300)
    StartDrawing(TextureOutput(t1(p)))
      w=OutputWidth():h=OutputHeight()
      DrawingMode(#PB_2DDrawing_AlphaBlend)
      Box(0,0,w,h,$ff888888)
      Box(10,10,w-20,h-20,$ff000000)
      ClipOutput(10,10,w-20,h-20)
        For n=1 To 50
          Box(Random(w),Random(h),Random(100),3,RGBA(Random(100),Random(255,155),Random(100),255))
        Next n
        Box(140,300-(p*30),20,20,$ff00ffff)
      UnclipOutput()
    StopDrawing()
    t1ID(p)=TextureID(t1(p))
  Next p

  mm= CreateAnimatedMaterial(#PB_Any,t1ID(),3)
  DisableMaterialLighting(mm,1)
  MaterialFilteringMode(mm,#PB_Material_Anisotropic,8)
  Dim b(20)
  Dim b2(20)
  For p= 1 To 20
    sy.f= Random(40,10)+(Random(20)*0.1)
    sx.f= Random(20,10)+(Random(20)*0.1)
    sz.f= Random(20,10)+(Random(20)*0.1)
    px= -400+Random(800)
    pz= -400+Random(800)
;     b2(p)=CreateEntity(#PB_Any,MeshID(CreateCube(#PB_Any,1)),MaterialID(mm),sx,sy/2,sz)
    b(p)=CreateEntity(#PB_Any,MeshID(CreateCube(#PB_Any,1)),MaterialID(mm),px,sy/2,pz)
    ScaleEntity(b(p),sx,sy,sz,#PB_Absolute)
    CreateEntityBody(b(p),#PB_Entity_StaticBody,0,0.5,0.5)
  Next p
  ;}
  
  
  ;{ bill
  t4= CreateTexture(#PB_Any,300,300)
  StartDrawing(TextureOutput(t4))
    w=OutputWidth():h=OutputHeight()
    DrawingMode(#PB_2DDrawing_AllChannels)
    Box(0,0,w,h,$00000000)
    DrawingMode(#PB_2DDrawing_AlphaBlend|#PB_2DDrawing_Gradient)
    BackColor($ff0000ff)
    GradientColor(0.9,$ff0000ff)
    FrontColor($000000ff)
    CircularGradient(150,150,149)
    Circle(150,150,149)
  StopDrawing()
  billma= CreateMaterial(#PB_Any,TextureID(t4))
  MaterialCullingMode(billma,#PB_Material_NoCulling)
  MaterialBlendingMode(billma,#PB_Material_AlphaBlend)
  DisableMaterialLighting(billma,1)
  bill= CreateBillboardGroup(#PB_Any,MaterialID(billma),100,100)
  ;}
  ;{ objetos enemigos
  Dim t3(9): Dim t3ID(9)
  For p= 0 To 9
    t3(p)=     CreateTexture(#PB_Any,300,300)
    StartDrawing(TextureOutput(t3(p)))
      w=OutputWidth():h=OutputHeight()
      DrawingMode(#PB_2DDrawing_AlphaBlend)
      Box(0,0,w,h,$ff000099)
      Box(10,10,w-20,h-20,$ff000000)
      ClipOutput(10,10,w-20,h-20)
        For n=1 To 50
          Box(Random(w),Random(h),Random(100),5,RGBA(Random(255,155),Random(100),Random(100),255))
        Next n
        Box(100,300-(p*30),100,20,$ff0000ff)
        UnclipOutput()
        Circle(150,150,10+ p * 10,$aa0000ff)
    StopDrawing()
    t3ID(p)=TextureID(t3(p))
  Next p
  mme= CreateAnimatedMaterial(#PB_Any,t3ID(),2)
  DisableMaterialLighting(mme,1)
  ScaleMaterial(mme,0.125,0.125)
  ScrollMaterial(mme,0,0.5,#PB_Material_Animated)
  enemymesh= CreateSphere(#PB_Any,10,16,8)
  ;}
  
  ;player
  player= CreateEntity(#PB_Any,MeshID(CreateSphere(#PB_Any,5)),#PB_Material_None,0,10,20)
  HideEntity(player,1)
  ;marcador
  marcador= CreateEntity(#PB_Any,MeshID(CreateCube(#PB_Any,1)),MaterialID(mm),0,100,0)
  ScaleEntity(marcador,100,100,100,#PB_Absolute)
  CreateEntityBody(marcador,#PB_Entity_StaticBody)
  marcadorBorde= CreateEntity(#PB_Any,MeshID(CreateCube(#PB_Any,1)),MaterialID(mme),0,150,0)
  ScaleEntity(marcadorBorde,101,2,101,#PB_Absolute)
  marcadorBorde= CreateEntity(#PB_Any,MeshID(CreateCube(#PB_Any,1)),MaterialID(mme),0,49,0)
  ScaleEntity(marcadorBorde,102,2,102,#PB_Absolute)
  
  MoveCamera(0, 300,100,300,#PB_Absolute)
  CameraLookAt(0,0,0,0)
  msgthanks.s= "🚗 [WASD=Move, SPACE=Jump] - Created by Toni Manrique 2026® (minimy) - Free for your use. NOT FOR COMERCIAL USE, Especial thanks to: "+
       "Fred and PB team. PF_Shadoko, Miso, Idle, Mindphazer, Hexor, Carm3D, Infratec, TI-994A, mk-soft, RASHAD, Andre, netmaetro, marc_256, Dige, Pjay, PB, PureLust, Axoloti, SMaag, "+
       "Skipper, Roby, Booger, Skinkairewalker, Azjio, Darius676, Threedslider, Icesoft, Mesa, Zapman, zikitrake, Caronte3D, Mijikai, Little John, CDXbow, ChrisR, Fangbeast, Luis, SPH, benubi, Thyphoon, PeDe, Piero, Kwai Chang Caine, Chris R, STARGÅTE, Olli, "+
       "Ricardo sdl, Diceman, Barry G, Randy Walker, PHP, coco2, kuron, naf, jacobus, StephanB, Jamiroqwai, Bericko, Bisonte, srod, Michael Vogel, oryaaaaa, wombats, QuimV, Susan, blueb, and all the PureBasic members, I apologize if you are not on the list, but there are too many.!!..."
  msg=msgthanks
  
  CreateEntityBody(suelo,#PB_Entity_StaticBody,0,0.5,0.5)
  CreateEntityBody(player,#PB_Entity_SphereBody,1,1,0.7)
  vx.f=0
  vy.f=0
  vz.f=0
  spd.f= 1
  
  tambores()
  HideWindow(0,0)
  
  Debug ""
  
  ;--- TEST
  Repeat
    Repeat
      ev= WindowEvent()
    Until ev=0
    
    ExamineKeyboard():ExamineMouse()
    
    Select modo
      Case 0
        MoveCamera(0, 5,0,0,#PB_Local)
        CameraLookAt(0,0,0,0)
        If KeyboardReleased(#PB_Key_Space)
          ronda= 1
          ForEach npcs()
            If FindMapElement(bbb(),Str(npcs()))
              RemoveBillboard(bbb(),bill)
              DeleteMapElement(bbb(),Str(npcs()))
              FreeEntity(npcs())
            EndIf
          Next
          ClearList(npcs())
          enemys= 5
          lives= 5
          For p= 1 To enemys
            AddElement(npcs())
            npcs()=  CreateEntity(#PB_Any,MeshID(enemymesh),MaterialID(mme),Random(900)-450,Random(50,10),Random(900)-450)
            CreateEntityBody(npcs(),#PB_Entity_SphereBody,1,1,0.7)
            bbb(Str(npcs()))=AddBillboard(bill,0,10,0):ResizeBillboard(bbb(),bill,24,24)
          Next p
          modo= 1
          DisableEntityBody(player,1)
          MoveEntity(player,0,10,0,#PB_Absolute)
          DisableEntityBody(player,0)
        EndIf
      Case 1
        ;{ JUGANDO
        MoveEntity(sky,CameraX(0),0,CameraZ(0),#PB_Absolute)
        npc(player)
        targetX.f = -MouseDeltaX() * 0.05
        targetY.f = -MouseDeltaY() * 0.05
        smoothX.f + (targetX - smoothX) * 0.2
        smoothY.f + (targetY - smoothY) * 0.2
        RotateCamera(cam, smoothY, smoothX, 0, #PB_Relative)
        fx.f = 0: fy.f = 0: fz.f = 0
        acc.f = 5.0
        cx.f = CameraDirectionX(0): cy.f = CameraDirectionY(0): cz.f = CameraDirectionZ(0)
        If KeyboardPushed(#PB_Key_D)
          fx + -cz * acc: fy +  cy * acc: fz +  cx * acc
        EndIf
        If KeyboardPushed(#PB_Key_A)
          fx +  cz * acc:fy +  cy * acc: fz + -cx * acc
        EndIf
        If KeyboardPushed(#PB_Key_W)
          fx + cx * acc: fy + cy * acc: fz + cz * acc
        EndIf
        If KeyboardPushed(#PB_Key_S)
          fx + -cx * acc: fy + -cy * acc: fz + -cz * acc
        EndIf
        If KeyboardPushed(#PB_Key_Space)
          If EntityY(player)<6
            If Bool(EntityX(player) > -500 And EntityX(player) < 500) And Bool(EntityZ(player) > -500 And EntityZ(player) < 500)
              ApplyEntityImpulse(player, 0, 15, 0)
            EndIf
          EndIf
        EndIf
        ApplyEntityForce(player, fx, fy, fz)
        EntityAngularFactor(player, 0, 0, 0)
        MoveCamera(0, EntityX(player), EntityY(player), EntityZ(player), #PB_Absolute)
        dead()
        ;}
      Case 2
        MoveCamera(0, 600,100,300,#PB_Absolute)
        CameraLookAt(0,0,0,0)
        If KeyboardReleased(#PB_Key_Space)
          MoveCamera(0, 300,100,300,#PB_Absolute)
          msg= msgthanks
          modo= 0
          timer= 0
        EndIf
        drawGameOver()
    EndSelect
    
    CameraReflection(1,0,EntityID(suelo))
    RenderWorld(40)
    
    Select modo
      Case 0
        If ElapsedMilliseconds() > dibujaScore
          drawMenu()
          dibujaScore= ElapsedMilliseconds()+25
        EndIf
      Case 1
        If ElapsedMilliseconds() > dibujaScore
          enemys= ListSize(npcs())
          oldTimer = timer
          timer + ronda
          If (oldTimer / 1000) < (timer / 1000)
            lives + 1
          EndIf
          msg= "Round: "+Str(ronda)+"  Score: "+Str(timer)
          drawMarcador()
          dibujaScore= ElapsedMilliseconds()+950
          
        EndIf
    EndSelect
    SetWindowTitle(0,"Whats up TRON? "+Str(Engine3DStatus(#PB_Engine3D_CurrentFPS)))
    FlipBuffers(): Delay(1): If KeyboardPushed(#PB_Key_Escape):salApp=1:EndIf
  Until salApp=1: End
End
If translation=Error: reply="Sorry, Im Spanish": Endif
Drone
User
User
Posts: 17
Joined: Fri May 03, 2019 10:21 pm

Re: Whats up TRON? - FULL GAME

Post by Drone »

Thank You !

1) It was a bit fast on my gaming laptop. How to set the speed of the game ?

2) DPI should be off before running the game or it looks weird.
Something like this would help :

Code: Select all

CompilerIf #PB_Compiler_DPIAware = 1
  CompilerError "DPI is enabled. Turn it off before playing the game..."
CompilerEndIf
User avatar
minimy
Addict
Addict
Posts: 874
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: Whats up TRON? - FULL GAME

Post by minimy »

Drone wrote: Sun Feb 08, 2026 3:18 pm Thank You !

1) It was a bit fast on my gaming laptop. How to set the speed of the game ?

2) DPI should be off before running the game or it looks weird.
Something like this would help :

Code: Select all

CompilerIf #PB_Compiler_DPIAware = 1
  CompilerError "DPI is enabled. Turn it off before playing the game..."
CompilerEndIf
Hi Drone, thanks to you.
1) Yes i forget it, sorry.
2) RenderWorld(40) adjust the physic speed, try with RenderWorld(30) or less. I think about 14 is the normal speed.
If translation=Error: reply="Sorry, Im Spanish": Endif
Drone
User
User
Posts: 17
Joined: Fri May 03, 2019 10:21 pm

Re: Whats up TRON? - FULL GAME

Post by Drone »

minimy wrote: Sun Feb 08, 2026 4:13 pm
Drone wrote: Sun Feb 08, 2026 3:18 pm Thank You !

1) It was a bit fast on my gaming laptop. How to set the speed of the game ?

2) DPI should be off before running the game or it looks weird.
Something like this would help :

Code: Select all

CompilerIf #PB_Compiler_DPIAware = 1
  CompilerError "DPI is enabled. Turn it off before playing the game..."
CompilerEndIf
Hi Drone, thanks to you.
1) Yes i forget it, sorry.
2) RenderWorld(40) adjust the physic speed, try with RenderWorld(30) or less. I think about 14 is the normal speed.
Much better. Thank You. :D
BarryG
Addict
Addict
Posts: 4331
Joined: Thu Apr 18, 2019 8:17 am

Re: Whats up TRON? - FULL GAME

Post by BarryG »

minimy wrote: Wed Feb 04, 2026 11:52 pmMore than 150 downloads and not a single thank you. It seems we have an education problem or something else.
I will share code again when the attitude changes.
Code removed.
This is the first time I've seen it. So, thank you. :)
User avatar
idle
Always Here
Always Here
Posts: 6202
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Whats up TRON? - FULL GAME

Post by idle »

Just got around to having a look, I've been on full time toddler duty last few days.
Seems you only have to put your back against the wall and sit there to get points!
maybe you subtract points for hitting a wall.
Thanks for sharing and yes the lack of thanks or acknowledgment is unfortunately the reality today.
miso
Enthusiast
Enthusiast
Posts: 703
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: Whats up TRON? - FULL GAME

Post by miso »

The best way for speed limitation is to adjust forces with delta time or game tick. It's reversed for what I'm used to, but small physics time causes delays if there are a lot of collision objects / static tris. On my faster machine I just had set the maximum impulse before renderworld, that way they could not add together into infinity speed. I already commented on the original topic, but here again, thanks for sharing nice one. I like the smoothness of the camera movement and the visuals. Great that it has sounds, though the music is "programmer art" ;) Still great that it has.
threedslider
Enthusiast
Enthusiast
Posts: 603
Joined: Sat Feb 12, 2022 7:15 pm

Re: Whats up TRON? - FULL GAME

Post by threedslider »

Don't worry, there are many thanks from us, simply we are somewhat busy so I say thank you a lot for your nice work :mrgreen:

Keep it up as always, dude !
Sergey
User
User
Posts: 91
Joined: Wed Jan 12, 2022 2:41 pm

Re: Whats up TRON? - FULL GAME

Post by Sergey »

Nice game, with physics and beautiful colors
And beat make me move :)
The font size is too big and enemies, as I know
User avatar
minimy
Addict
Addict
Posts: 874
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: Whats up TRON? - FULL GAME

Post by minimy »

I'm not saying this for you, you are one of those who are grateful.
The problem is the voyeurs, they take, they don't contribute and on top of that they don't even give thanks.
Many of you have shared wonderful codes and it bothers me that no one thanks you.
I think the only way is to say it clearly.
A box on the 'REGISTERED USERS ONLY' forum would be nice, this would prevent voyeurs and bots from collecting code.
In any case, thanks friends! :D
If translation=Error: reply="Sorry, Im Spanish": Endif
benubi
Enthusiast
Enthusiast
Posts: 243
Joined: Tue Mar 29, 2005 4:01 pm

Re: Whats up TRON? - FULL GAME

Post by benubi »

Hi!

Sorry for the late message, my participation is always a little irregular. Thanks for mentioning me in the credits! :D
I wasn't sure if you were using 2d or 3d, but it's a little of both. Still trying to figure out some things. I figured out the collisions are handled by ogre/bullet. What are the billboards doing? Is it for drawing contours around the balls?

I have to check this through :)
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5664
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Whats up TRON? - FULL GAME

Post by Kwai chang caine »

I don't know anything about 3D or games, since my thing is only utilities. :wink:
But that doesn't stop me from being constantly impressed by what you manage to do all, with PB. :shock:
My opinion is worthless, but I found your game and it blew my mind in seconds...brilliant!

Thanks a lot for sharing this great code 8)
ImageThe happiness is a road...
Not a destination

PureBasic French Forum
User avatar
minimy
Addict
Addict
Posts: 874
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: Whats up TRON? - FULL GAME

Post by minimy »

Thanks guys!
@benubi, better late than never. :lol:
@KCC, you are a very good programmer, don't be so modest. I have seen very good things about you.

with friends like you, motivation grows.
I'm glad you liked it.
I have played a few games and apart from the bugs it has hehe, it has a good time trying to eliminate the enemies.
If translation=Error: reply="Sorry, Im Spanish": Endif
Post Reply