Jump to content

Yue

Members
  • Posts

    2,371
  • Joined

  • Last visited

Everything posted by Yue

  1. What I do is create prefabricated ones, drag them to the editor, copy them and create the scenario. The same happens with the character, it is loaded from the stage ( map editor ).
  2. I think the point is in my computing power, it doesn't matter anymore. Initially I had an e5400 processor and I passed it to e8400, but still this hangs.
  3. This is the best I can have in performance, however if I place more elements such as platforms columns walls at the base of the brushes, the fps begins to drop drastically. What I'm doing is creating prefabricated elements, putting them on stage and copying them and positioning ourselves to create levels.
  4. What is it really? How can I use it to improve performance levels. If I create a lot of cubes, I have performance deterioration, so if I have a single platform I don't have problems, but if I have a lot this goes down to 20 fps.
  5. I think the motivation goes away when I'm faced with problems outside Leadwerks. Technical problems.
  6. I'm always learning something, and thanks to your input, I saw the GetAirborne command, really my system lacks that command, and no more at first glance I think it serves to detect the character if it goes down. This is crazy.
  7. It is cheaper to create a level on the basis of brushs, or to load meshes created in external programs. This initially because I have performance problems really worrying, but is more for my computer system and I do not want to give up shadow effects and things like that, if not see if it is really feasible to create levels based on blocks, spheres and so on.
  8. Here Perfect. --################################################ --## Proyecto : Pawn. --## Sitio Web : https://www.iris3dgames.xyz --## Fichero : Player.lua --## Scripter : Yue Rexie. --################################################ --## Notas : Fichero Clase Player. --## Objetos Player son creados. --################################################ Player={} function Player:New(pick,hud) local this={} this.pivotPlayer = nil this.pivotCamera = nil this.cameraPlayer = nil this.player = nil this.pos = Vec3() this.vel = 0 this.rot = 0 this.pickInfo = 0 this.colGroundRay = false this.forceJump = 0 -- Animations. this.idle = "Idle" this.idleBox = "IdleBox" this.walk = "Walk" this.run = "Run" this.walkBox = "WalkBox" this.runBox = "RunBox" this.jump = "Jump" this.dead = "Dead" this.falling = "Falling" this.fallingB = "FallingBox" this.kick = "Kick" this.energyOff = "EnergyOff" this.animation = nil this.velAnim = 0.03 this.typeAnim = 0 this.blend = 100 this.energyOut = 0.001 this.energyRun = 0 this.energyWalk = 0 this.soundWalk = nil this.channelWalk = nil this.pitch = nil this.soundWind = nil this.channelWind = nil this.soundMusic = nil this.channelMusic = nil function this:StartCameraOrbit(player,pivotPlayer, pivotCamera, cameraPlayer) self.player = player self.pivotPlayer = pivotPlayer self.pivotCamera = pivotCamera self.cameraPlayer = cameraPlayer self.pivotCamera:SetParent(self.pivotPlayer,true) self.cameraPlayer:SetRange(0.01,1000) self.player:SetPickMode(0) self:InitSoundWalk() --self:InitSoundAmbient() end function this:InitSoundAmbient() self.soundWind = Sound:Load("Sound/Ambient/Viento.wav") self.channelWind = Source:Create() self.channelWind:SetSound(self.soundWind) self.soundWind:Release() self.channelWind:SetVolume(0.2) self.channelWind:SetLoopMode(true) self.channelWind:Play() self.soundMusic = Sound:Load("Sound/Ambient/airtone_nightRain.wav") self.channelMusic = Source:Create() self.channelMusic:SetSound(self.soundMusic) self.soundMusic:Release() self.channelMusic:SetVolume(0.3) self.channelMusic:SetLoopMode(true) self.channelMusic:Play() end function this:InitSoundWalk() self.soundWalk = Sound:Load("Sound/Player/footstep.wav") self.channelWalk = Source:Create() self.channelWalk:SetSound(self.soundWalk) self.soundWalk:Release() self.channelWalk:SetLoopMode(true) self.channelWalk:SetVolume(1) self.channelWalk:Play() self.channelWalk:Pause() self.pitch = self.channelWalk:GetPitch() end function this:Update() self:UpdateCameraOrbit() self:UpdateMovent() self:Jump() self:ColRayCamera() self:Animations() end function this:UpdateSounds() if self.colGroundRay == true then if Window:GetCurrent():KeyHit(Key.Shift) then self.channelWalk:SetPitch(self.channelWalk:GetPitch()*2) end if Window:GetCurrent():KeyDown(Key.Shift) == false then self.channelWalk:SetPitch(self.pitch) end if Window:GetCurrent():KeyHit(Key.W) or Window:GetCurrent():KeyHit(Key.S) then self.channelWalk:Resume() end if Window:GetCurrent():KeyDown(Key.W)==false and Window:GetCurrent():KeyDown(Key.S)==false then self.channelWalk:Pause() else self.channelWalk:Resume() end end end function this:UpdateCameraOrbit() if menuVisible == 1 then self.sx = Math:Round(Context:GetCurrent():GetWidth()/2) self.sy = Math:Round(Context:GetCurrent():GetHeight()/2) self.posMouse = Window:GetCurrent():GetMousePosition() Window:GetCurrent():SetMousePosition( self.sx, self.sy ) self.dx = self.posMouse.x - self.sx self.dy = self.posMouse.y - self.sy self.rotacion = self.pivotPlayer:GetRotation() if self.rotacion.x >= 60 then self.rotacion.x = 60 elseif self.rotacion.x <= -45 then self.rotacion.x = -45 end self.rotacion.y = self.rotacion.y + self.dx / 50.0 / Time:GetSpeed() self.rotacion.x = self.rotacion.x + self.dy / 50.0 / Time:GetSpeed() --## Rotate Pivot Player. self.pivotPlayer:SetRotation(self.rotacion, true ) end end --## Movent Player. function this:UpdateMovent() self:UpdatePosPivotPlayer() self.velAnim = 0.03 hud.energy = self.energyOut self.energyOut = 0.001 if Window:GetCurrent():KeyDown(Key.W) then self.energyOut = self.energyWalk self:RunPlayer() if hud.posEnergy < 180.0 then self.rot = self.pivotPlayer:GetRotation(false).y end elseif Window:GetCurrent():KeyDown(Key.S) then self.energyOut = self.energyWalk self:RunPlayer() if hud.posEnergy < 180.0 then self.rot = self.pivotPlayer:GetRotation(false).y -180 end else self.vel = 0 end if Window:GetCurrent():KeyDown(Key.W) or Window:GetCurrent():KeyDown(Key.S) then if pick.itemBox == false then self.animation = self.walk else self.animation = self.walkBox end if Window:GetCurrent():KeyDown(Key.Shift) then if pick.itemBox == true then self.animation = self.runBox else self.animation = self.run end end else if pick.itemBox == false then self.animation = self.idle else self.animation = self.idleBox end end if Window:GetCurrent():KeyDown(Key.E) then --if pick.itemBox == false then self.typeAnim = 0 self.animation = self.kick --end end if hud.posEnergy < 180 then else self.vel = 0 end self.player:SetInput(self.rot,self.vel, 0, self.forceJump,false, 1.0, 0.5, true, 0) end function this:UpdatePosPivotPlayer() self.pivotPlayer:SetPosition(self.player:GetPosition().x,self.player:GetPosition().y+1.7,self.player:GetPosition().z) end function this:RunPlayer() self.velAnim = 0.03 self.vel = 1.5 if Window:GetCurrent():KeyDown(Key.Shift) then self.vel = 3.5 self.energyOut = self.energyRun self.velAnim = 0.05 end end function this:Jump() self.forceJump = 0.0 if self:GetColRay() == true then --System:Print(self.pickInfo.position) self.pos = self.pickInfo.position self.typeAnim = 0 self:UpdateSounds() --self.animation = self.idle else self.typeAnim = 1 if pick.itemBox == false then self.animation = self.falling else self.animation = self.fallingB end self.channelWalk:Pause() if self.player:GetPosition().y < self.pos.y - 25 then self.player:SetPosition(self.pos.x,self.pos.y+5,self.pos.z) end end --self.typeAnim = 0 --## Jump. if Window:GetCurrent():KeyHit(Key.Space) == true then if self:GetColRay() == true then self.animation = self.jump self.typeAnim = 1 self.velAnim = 0.5 --self.forceJump = 7.0 end end end function this:GetColRay() self.pickInfo = PickInfo() self.colGroundRay = World:GetCurrent():Pick(Vec3(self.player:GetPosition(true).x, self.player:GetPosition(true).y+0.1, self.player:GetPosition(true).z), Vec3(self.player:GetPosition(true).x, self.player:GetPosition(true).y-0.5, self.player:GetPosition(true).z),self.pickInfo, 0.001 ) --self.posBone1 = self.player:FindChild("Rayo"):GetPosition(true) --self.colGroundRay = World:GetCurrent():Pick(self.posBone1.x,self.posBone1.y+0.2,self.posBone1.z, self.posBone1.x,self.posBone1.y-0.2, self.posBone1.z, self.pickInfo,0,true,0) --System:Print(self.player:GetCollisionType()) return self.colGroundRay end function this:ColRayCamera() self.posPivotPlayer = self.pivotPlayer:GetPosition(true) self.posPivotCamera = self.pivotCamera:GetPosition(true) self.pickInfoRayCamera = PickInfo() self.GetColRayCamera = World:GetCurrent():Pick( self.posPivotPlayer, self.posPivotCamera,self.pickInfoRayCamera,0,true ) self.cameraPlayer:SetRotation(self.pivotCamera:GetRotation(true)) if self.GetColRayCamera then self.cameraPlayer:SetPosition(self.pickInfoRayCamera.position.x+(self.pickInfoRayCamera.normal.x/12),self.pickInfoRayCamera.position.y+(self.pickInfoRayCamera.normal.y/12.0),self.pickInfoRayCamera.position.z+(self.pickInfoRayCamera.normal.z/12.0),false) else self.cameraPlayer:SetRotation(self.pivotPlayer:GetRotation(true)) self.cameraPlayer:SetPosition(self.pivotCamera:GetPosition(true)) end end --## Animation Player. function this:Animations() if hud.posEnergy < 180.0 then else self.animation = self.dead end self.player:PlayAnimation(self.animation, self.velAnim,self.blend,self.typeAnim ) end return this end
  9. My daughter says it's the sound of a food board.?
  10. https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_SetInput
  11. have a problem, when the player takes a box to transport it the shape assigned to that box is removed, and the mass is set to zero. Now, when you release the box, you assign a shape again, but this does not match the size of the box, it is much bigger, any suggestions please? --## Acction Objects. function this:AcctionsObjects() if self.ray then if self.pickInfo.entity:GetKeyValue("name") == "Cajas" then if Window:GetCurrent():KeyDown(Key.E) then if self.acction == 0 then self.pickInfo.entity:SetDamping(0,0) self.pickInfo.entity:SetOmega(45,45,45) self.forceKick = Vec3(0,0, 500) self.forceKick = Transform:Vector( self.forceKick, self.player, nil) self.pickInfo.entity:AddPointForce( self.forceKick,self.player:GetPosition(true)) else if self.itemBox == false then self.pickInfo.entity:SetShape(nil) self.pickInfo.entity:SetMass(0) self.pickInfo.entity:SetParent(self.player:FindChild("ItemCabeza"),true) self.pickInfo.entity:SetPosition(0,0,0) self.pickInfo.entity:SetRotation(0,0,0) self.pickInfo.entity:SetPickMode(0) self.acction = 0 self.itemBox = true self.box = self.pickInfo.entity Window:GetCurrent():FlushKeys() end end end end else --## Shoot Box. if self.itemBox == true then if Window:GetCurrent():KeyHit(Key.E) then self.box:SetParent(nil) self.box:SetPickMode(Entity.BoxPick) self.shapeBox = Shape:Box() self.box:SetShape(self.shapeBox) self.shapeBox:Release() self.box:SetMass(2.0) Window:GetCurrent():FlushKeys() end end end end
  12. What I have is this for my character. https://paste.ofcode.org/eGevSatEFbYMYjnp2tXfbj
×
×
  • Create New...