Jump to content

Yue

Members
  • Posts

    2,291
  • Joined

  • Last visited

Everything posted by Yue

  1. -- *********************************** -- Proyecto : Astrocuco -- Scripter : Yue Rexie -- Fichero : CPlayer.lua -- *********************************** -- Notas : Clase CPlayer para -- crear el objeto Player. -- *********************************** import ("Scripts/Class/CCamP.lua") import ("Scripts/Class/CMove.lua") import ("Scripts/Class/CAnimP.lua") import ("Scripts/Class/CHudP.lua") import ("Scripts/Class/CItemsV.lua") import ("Scripts/Class/CInven.lua") import ("Scripts/Class/CRag.lua") CPlayer={ camera = nil; move = nil; anim = nil; hud = nil; itemsV = nil; inven = nil; rag = nil; New = function (self) local this={} setmetatable(this,self) self.__index = self function this:Init() self.window = Window:GetCurrent() self.camera = CCamP:New() self.move = CMove:New() self.anim = CAnimP:New() self.hud = CHudP:New() self:StartHud() --self.itemsV = CItemsV:New() self:StartInven() self.rag = CRag:New() System:Print(">>> ### CREANDO OJBETO PLAYER... ¡OK! ### <<<") end function this:StartInven() self.inven = CInven:New() end function this:StartHud() self.hud = CHudP:New() end -- Update Player. function this:Update() self.camera:Update() self.move:Update() self.anim:Update() self.inven:Update() self.rag:Update() end function this:DrawHud() self.hud:Draw() end this:Init() return(this) end } This is my workflow for a character in Leadwerks. I think my hobby is to learn things and improve my skills, maybe someday I'll make a video game.
  2. An object is a list of attributes that represent an object to us as programmers. In the real world we have objects like a ball, it has properties like color, material, and events that are triggered for example when the ball is kicked. This ball can be in another much larger object, a soccer stadium, where there are objects such as the field, the players, the referee. The idea of objects in programming, is that you work in smaller parts that are then of larger ones. Leadwerks has objects, such as the Windows object, which in turn has a context. So when you understand this, it is much more fun to program and you won't feel like your brain is going to explode, but you need time to assimilate these things and perceverance. Translated with www.DeepL.com/Translator (free version)
  3. What happens is that your game will be big as time goes by, and object oriented programming aims to break a huge program into smaller parts, the only thing I can think of and from my own experience is that it will take some time when you learn to program and understand Leadwerks. And then if you take the step to create a game. What I am trying to explain is that you have two options, one is to write your entire program in a single file, this would be equivalent to writing on an Egyptian paper, this will create spaghetti code, if you write your program as a book, separated by sheets, chapters and paragraphs. Because the hardest part is when you start debugging your program and most of the bugs are just in our coders head. And something important, don't give up. Translated with www.DeepL.com/Translator (free version)
  4. Yue

    Player Script DevLog

    It seems that this time I will succeed, the idea is to activate the ragdoll effect, and if the player still has life he will stand up. And if the life is at zero, he will not stand up. @Josh
  5. Yue

    Player Script DevLog

    Test to restore skeleton after the ragdoll effect, the idea that the character after activating the effect can stand up again. This test implies that by means of an animation I can restore it to its standing position. This is not conclusive, as I have to see how I attach the bones to the rigid bodies.
  6. -- *********************************** -- Proyecto : Astrocuco -- Scripter : Yue Rexie -- Fichero : CInput.lua -- *********************************** -- Notas : Clase CInput para -- crear el objeto Input. -- *********************************** CInput={ window = nil; New = function (self) local this={} setmetatable(this,self) self.__index = self function this:Init() self.window = Window:GetCurrent() System:Print(">>> ### CREANDO OBJETO INPUT... ¡OK! ### <<<") end function this:KeyHit(CodeKey) return (self.window:KeyHit(CodeKey)) end function this:KeyDown(CodeKey) return ( self.window:KeyDown(CodeKey)) end function this:FlushKeys() self.window:FlushKeys() end function this:MouseDown(CodeKey) self.window:MouseDown(CodeKey) end this:Init() return(this) end } Check out some of my object-oriented flow programming. Esto es una clase, y por lo regular la pongo en un fichero aparte. Ahora el siguiente paso es construir un objeto de esa clase. -- File Main.lua import("Class/CInput.lua") input = CInput:New() -- Sample. if input:KeyDown(Key.F) then System:Print("Key F Down") End Remember from the beginning that your whole game is one big object, which must be made up of other objects. Think of it as a car, a single object that has other objects, the wheels object, the chassis object, the engine object, the steering wheel object. All these objects must communicate with each other, the pedal object when pressed accelerates the motor object and makes the car move. The Main file, is the input file to the program, the rest are the way to structure your code. The entities within a map can be assigned scripts, but everything internally is executed from the Leadwerks core in a Loop depending on the case or at the start of the game.
  7. I think a camera would have a command to render shadows or not. RenderShadows(false), this would be very useful to save resources.
  8. Yue

    Player Script DevLog

    Dealing with the implementation of the Rag Doll effect. Whenever I repeat something, I always find the best way to do it.
  9. The funny thing is that we have to create something that people like and not just that we like. Look at trends, marketing research. On the other hand, sales, advertising, should be considered part of the investment in the development, it is what the big studios do, so everything is summarized in capital for the project that even if the game is very bad, a good marketing will make it visible at least for a critique and that people know about it. Translated with www.DeepL.com/Translator (free version)
  10. Yue

    Player Script DevLog

    Structuring the rag doll effect system.
  11. In my case, what has worked is to completely clean the main.lua file, and start from scratch, with the documentation in hand. this is like anything in life, to learn to play music, you learn by playing an instrument, and the same thing happens, you learn to program by programming. So what I do is to have the main.lua file and many files represented in objects through the use of tables (classes), and then these objects communicate with each other. The example is not to build a wall of a single block, as in prefabricated houses, but as is done here in Latin America, walls with several blocks, bricks that make up our program, if one fails it will not be necessary to knock down the entire wall. This has taken me several years to learn after trial and error. But I am sure that if you put your heart into it, you will learn something new and that is gratifying when we gain experience in something and make it applicable.
  12. Yue

    Player Script DevLog

    Beginning the nightmare of the Ragdoll, my lifelong enemy.
  13. Lua is a high level managed programming system and in a way it favors productivity, I've been trying to make a game for a long time, it's the excuse to learn to program always something new. For me the system that most favors me in Lua, is to simulate OOP programming (Object Oriented Programming), I do this through tables and files. What I do is to take a big problem and divide it into smaller parts. And to do this I had to start from scratch from main, and manage my own structure. With time you develop skills, I don't really consider myself a programmer, but I think that with time I have improved somewhat, because I am no longer trying to learn how to do things, but I am already doing them. Translated with www.DeepL.com/Translator (free version)
  14. Yes, it is compatible. I prefer Lua over C++ for productivity reasons and not to deal with compile times.
×
×
  • Create New...