Jump to content

macklebee

Members
  • Posts

    3,946
  • Joined

  • Last visited

Posts posted by macklebee

  1. how are you getting the terrain? It should work if you are properly accessing the terrain. Granted, the GetHeight() does not appear to provide any information anymore, but GetElevation() appears to work just fine.

    window = Window:Create("terrain example",0,0,800,600)
    context = Context:Create(window)
    world = World:Create()
    camera = Camera:Create()
    camera:SetPosition(0,60,0)
    camera:SetRotation(0,45,0)
    camera:SetMultisampleMode(8)
    pickinfo = PickInfo()
    Map:Load("Maps/terrain.map")
    for i=0,world:CountEntities()-1 do
    	if world:GetEntity(i):GetClass()==Object.TerrainClass then
    		terrain=world:GetEntity(i)
    		tolua.cast(terrain,"Terrain")
    		break
    	end
    end
    
    camrot = camera:GetRotation()
    gx=Math:Round(context:GetWidth()/2)
    gy=Math:Round(context:GetHeight()/2)
    move = 0
    strafe = 0
    
    while window:KeyDown(Key.Escape)==false do
    	if window:Closed() then break end
    	mouseposition = window:GetMousePosition()
    	dx = mouseposition.x - gx
    	dy = mouseposition.y - gy
    	camrot.x = camrot.x + dy / 10.0
    	camrot.y = camrot.y + dx / 10.0
    	camera:SetRotation(camrot)
    	window:SetMousePosition(gx,gy)
    	move = Math:Curve(((window:KeyDown(Key.W)and 1 or 0) - (window:KeyDown(Key.S) and 1 or 0)),move,10)
    	strafe = Math:Curve(((window:KeyDown(Key.D)and 1 or 0) - (window:KeyDown(Key.A) and 1 or 0)),strafe,10)
    	camera:Move(strafe,0,move)
    	
    	p = window:GetMousePosition()
    	if window:MouseDown(1) then
    		pick = camera:Pick(p.x,p.y,pickinfo,9,true)
    	end
    	
    	Time:Update()
    	world:Update()
    	world:Render()
     
    	
    	if pick then
    		context:SetBlendMode(Blend.Alpha)
    		context:DrawText("Height: "..terrain:GetHeight(pickinfo.position.x, pickinfo.position.y), 2, 2)
    		context:DrawText("Elevation: "..terrain:GetElevation(pickinfo.position.x, pickinfo.position.z), 2, 22)
    		context:SetBlendMode(Blend.Solid)
    	end
    	context:Sync()
    end

     

    terrain.jpg.f23407bdaefe53468cf6ca7b7cd4e058.jpg

    • Like 1
  2. 6 hours ago, Rick said:

    I think josh removed require() ability which almost all external modules use. 

    require() works just fine as long as lua is not sandboxed. Uncheck this option in the editor's Tools>Options...>General tab.

    • Upvote 1
  3. 2 hours ago, Crazycarpet said:

     I'm not sure what the terms of licensing would be...

    1% of the first sale of your game then double it for each sale afterwards, eye of newt, pickled frog legs, 1 bowl of M&M's with all the green ones removed, six geese a laying, your first great grandchild's new puppy after a day of them bonding with it, and the steering wheel to a tata nano,

  4. 3 minutes ago, Angelwolf said:

    It's psuedo, sorry, should have mentioned. I re-wrote the entire post and managed to omit that part!

    ok - and you also managed to omit what exactly the problem is... in your non-psuedo code, what exactly is it not doing? It would help if we knew that or saw the actual code.

    Edit - ok see that the else/if/else if statements were the problem

  5. is this psuedo-code? or are you asking why it is not working?

    if health>=1 and health <25 then 
    	hudText = "Critical" 
    elseif health>=25 and health<50 then 
    	hudtext = "Caution" 
    elseif health>=50 and health<75 then 
    	hudText = "Injured" 
    elseif health>=75 then 
    	hudText = "Fine"
    end

     

    • Upvote 1
  6. The only crash i get is when I melee the boxes. But I can see if i let this run for awhile there will be issues as the script memory is just constantly rising even when not doing anything. My guess that the issues are somewhere inside the 3 separate player entities with their own scripts you have sitting ontop of  each other?

    • Upvote 1
  7. Quote

    For animation in Leadwerks to work you require bones. Keyframe animation won't work.

    are the trigger and magazine bones or just other sub meshes in the model?

     

    hmmm - if you post the model, i think uu3d can convert it properly to something LE can use. But other than that you would need to place bones in the model and set the keyframes based on their PRS.

    • Upvote 1
  8. You have to manage your fonts just like any asset.

    window = Window:Create("font example",0,0,400,300)
    context = Context:Create(window)
    world = World:Create()
    camera = Camera:Create()
    light = DirectionalLight:Create()
    light:SetRotation(45,45,0)
    box = Model:Box()
    box:SetPosition(0,0,3)
    box:SetColor(1,0,0,1)
    	
    lilfont = context:GetFont()
    medfont = Font:Load("Fonts/arial.ttf", 24, Font.Smooth)
    bigfont = Font:Load("Fonts/arial.ttf", 48, Font.Smooth)
    
    while window:KeyDown(Key.Escape)==false do
    	if window:Closed() then break end
    
    	box:Turn(Time:GetSpeed()*0.5,Time:GetSpeed()*0.5,0)
    	
    	Time:Update()
    	world:Update()
    	world:Render()
    	context:SetBlendMode(Blend.Alpha)
    	context:DrawText(string.format("FPS: %.2f",Time:UPS()),0,10)
    	context:SetFont(bigfont)
    	context:DrawText("BIG FONT",0,30)
    	context:SetFont(medfont)
    	context:DrawText("MEDIUM FONT",0,80)
    	context:SetFont(lilfont)
    	context:SetBlendMode(Blend.Solid)
    	context:Sync(true)
    end

     

    font.jpg

    • Upvote 1
  9. Canardian/megatron/mika/cant-remember-previous-name was well known for making "strong statements" about everything that typically resembled what people nowadays call "alternative facts". So don't take anything posted by him to heart.

    • Upvote 1
×
×
  • Create New...