Jump to content

simpleprogrammer

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by simpleprogrammer

  1. Hello Josh,

    I want to thank you for all the hard-work you put into making Leadwerks game engine, website and C++ tutorials.

    However i would like to point out the change to the only listing C++ in your tutorials section is "not a good idea".

     

    I guess if you only want all your users to learn c++? I am really disappointed if this it true.

     

    Thanks,

    Leroy

  2. you would have to use the equivalent lua command for modulo, which would be:

    frame = math.fmod(frame, frameend - framebegin) + framebegin

    or

    frame = frame % (frameend - framebegin) + framebegin

     

    and you would not need the object script if you use this... but that is the whole purpose of the object script. Also, you could have easily just used the equivalent code from the object script inside this standalone script.

     

    Thank very much for your help. IT"S WORKING NOW AGAIN>>>>>>>

     

    So i could use the sample code in the stand alone script and use the findchild command to call it out from the scene file.

    I need more practic finding the equivalent command. I didn't know where to start being a noobie and all.\

     

    ;)

  3. er-- why not use the object script i showed you the other day for your model?

     

    but in any case, look at this line:

    frame=frameend-framebegin+framebegin

    essentially you are just setting the frame variable to frameend each time... you need to cycle the frame value like this:

    frame = (frame Mod (frameend - framebegin)) + framebegin

    granted this just one way to do it... there are plenty of ways to calculate the frame parameter for the Animate command...

     

    I like the way you did it and really appreciated your help. But i made this code work in C++ and couldn't sleep

    at night with out learning how to make it work the same in lua. Does that make sence.

     

     

    I tried the (frame Mod (frameend - framebegin)) and i get a Lua error string "start.lua 56 expected near 'Mod' when i try and run it.

    Why does this happen? if remove the mod the script will run but just move the engine one frame.

     

    Thank you,

    Leroy

  4. Hello All,

    I am tyring to use the findchild command to animate a model in a scene file.

    Does anyone know what i am doing wrong with my lua script. I get the model to just move a little bit then stop.

     

    Help what am i doing wrong?

    Thank you,

    Leroy

     

     

    require("Scripts/constants/engine_const")
    //Register the Path
    RegisterAbstractPath("")
    
    
    //Setup the display mode
    Graphics(800,600)
    
    
    
    //Frame Work of the leadwerks
    
    
    fw = CreateFramework()
    
    //Setup the camera
    camera = fw.main.camera
    camera:SetPosition(Vec3(0,2,-10))
    
    
    camRotation=Vec3(0,0,0)
    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
    HideMouse(1)
    
    
    
    //Home made scene
    scene = LoadScene("abstract::leroy1.sbx")
    
    //Find Inworld Camera
    cameraleroy = scene:FindChild("start")
    
    AppLog(cameraleroy)
    //Position Camera in start point
    fw.main.camera:SetPosition(cameraleroy:GetPosition())
    
    
    framebegin = 0
    frameend = 0
    frame =0
    
    //Find animated engine inworld
    leroyengine = scene:FindChild("engineone")
    
    
    
    
    
    while KeyHit(KEY_ESCAPE)==0 do
    
    
    //Animate engine model
    framebegin=100.0
    frameend=227.0
    frame=AppTime()/100.0
    frame=frameend-framebegin+framebegin
    Animate(leroyengine,frame,1.0,0,true)
    
    
    
    UpdateAppTime()
    
    
    
    //Camera Look Around
    
    gx=Curve(MouseX()- GraphicsWidth()/2,gx,10)
    gy=Curve(MouseY()- GraphicsHeight()/2,gy,10)
    MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
    
    camRotation.x = camRotation.x+gy /10
    camRotation.y = camRotation.y-gx /10
    camera:SetRotation(camRotation,1)
    
    //Run engine inworld
    
    
    
    
    
    //keys
    move = Curve(KeyDown(KEY_W)-KeyDown(KEY_S),move,10)
    strafe = Curve(KeyDown(KEY_D)-KeyDown(KEY_A),strafe,10)
    camera:Move(Vec3(strafe /15,0,move,15))
    
    fw:Update()
    fw:Render()
    
    Flip(0)
    
    
    end
    
    
    
    
    
    
    
    
    

  5. Thank you that totaly helps :)

    I am on my way now.

     

    I don't know how to do it entirely in C++ but this is a way for Lua. When you do it with Lua you can either use the main program or use a per entity script (object script). I am going to explain the last one.

     

    Lets say you have a gmf named soldier.gmf. You need to make soldier.lua file in the same folder as the gmf file. Then add some code:

     

    require("scripts/class")
    
    local class=CreateClass(...)
    
    function class:CreateObject(model)
           local object=self.super:CreateObject(model)
    
    function object:Render()    
           if KeyDown(KEY_UP)==1 then    
               frame = (AppTime()/35.0) % (ENDFRAME-STARTFRAME) + 1                
               model:Animate( frame, 1,0, 1 )         
           end
    end

    replace ENDFRAME with the last frame of the animation and STARTFRAME with the first frame of the animation. The /35 is used for the speed of the animation. You have to tweak it a little to your own needs.

  6. Hello All,

    I am a noobie to Lua and c++, I would like to learn this in Lua. However i would like to control mesh animation loaded into a Leadwerks scene.

    Currently i have a mesh animated and want to control the animation with a keyboard key with sound started at the same time.

     

    So how do you control a animated mesh with a keyboard key when it's loaded into a scene? Also my question is, Do i need to control the animation from inside the Editor and save it with the scene.

     

    Let me know if am not clear on anything.

     

    Thank you,

  7. Hello,

    Thanks for your responce,

    I did do all the tutorials Josh had to offer in the old engine. Also looked at them again today.

    Also i am using C++VS2008 express to answer your quesiton. Also do you have a code example of

    first person shooter getting in to a car or truck i could see and learn from?

     

     

    ALso is there any tutorials on modeling a car and rigging it to work in Leadwerks?

     

    Thank you,

    Leroy

     

    '

    I actually ment which coding language are you going to use?

    You can either watch the C++ tutorials which start from the ground on up. There are also several Blitzmax and Lua tutorials.

     

    The editor comes with a First person and a driver script. However I do not recommend learning coding by looking at those scripts. They are to big for some one new to completely understand how they work.

  8. Hello and thank you for your responce,

     

     

    I would like a code example ride in the text car in the new editor.

    So a first person view, also what ever models i load into the Editor show up in the complied version.

     

     

    Just show a code exmaple to do this please to get my started with the new engine.

     

    THank you,

    Leroy

     

     

    which code are you looking for?

×
×
  • Create New...