Jump to content

X54321

Members
  • Posts

    40
  • Joined

  • Last visited

Everything posted by X54321

  1. Hmm, maybe it's just a problem that's fixed in the beta version. I may or may not switch to the beta version later, is there any risk of corrupting my project?
  2. Yes, I have already stated it isn't nil. I did both of the things you mentioned, and it was not nil.
  3. New Information! SetFont() works perfectly fine if I call it in the Script:Start() function; But why not in Script:PostRender()?
  4. That's because I have custom variables for Delta mouse coordinates in App.lua. You can comment that out, it just controls the camera movement. The camera's script also references one of those variables.
  5. I'M BACK! I'm trying to load a special font for the health percentage in my game; Loading the font goes by smoothly, but when I actually try to set the font it crashes. I know the font isn't nil (I tested it) and it can't be the font I'm using because it's the default font, except with a different size. Anyways, here's some code: local window = Window:GetCurrent() local forward = 0 local strafe = 0 local angle = 0 local firing = false local shootTimer = 0 local health = 100 local pickInfo = PickInfo() function Script:Start() self.w1 = Texture:Load("Materials/HUD/gun_overlay.tex") self.w1f = Texture:Load("Materials/HUD/gun_overlay_02.tex") self.ch = Texture:Load("Materials/HUD/crosshair.tex") self.hb = Texture:Load("Materials/HUD/healthbar.tex") self.entity:SetKeyValue("weapon", "blaster") self.entity:SetKeyValue("type", "player") self.font = Font:Load("Materials/Fonts/arial.ttf",36) local material = Material:Create() material:SetBlendMode(5) self.entity:SetMaterial(material) material:Release() end function Script:UpdateWorld() window = Window:GetCurrent() angle = angle - dx * 0.25 local jump = 0 if window:KeyDown(Key.Space) and self.entity:GetAirborne() == false then jump = 10 end if window:MouseHit(1) and firing == false and self.entity:GetKeyValue("weapon") ~= "none" then firing = true local p0 = self.entity:GetChild(0):GetPosition(true) local p1 = Transform:Point(0,0,20,self.entity:GetChild(0),nil) self.entity.world:Pick(p0,p1, pickInfo, 0, true) if pickInfo.entity ~= nil then if pickInfo.entity:GetKeyValue("type") == "enemy" then pickInfo.entity:SetKeyValue("hurt", "true") end end end if firing == true and shootTimer < 24 then shootTimer = shootTimer + 1 elseif firing == true and shootTimer == 24 then shootTimer = 0 firing = false end forward = (window:KeyDown(Key.W) and 1 or 0)*6 - (window:KeyDown(Key.S) and 1 or 0) * 6 strafe = (window:KeyDown(Key.D) and 1 or 0)*6 - (window:KeyDown(Key.A) and 1 or 0) * 6 self.entity:SetInput(angle, forward, strafe, jump, false) onGround = false end function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:SetColor(1,1,1,1) context:DrawImage(self.ch, 400 - 16, 300 - 16) --context:DrawImage(self.hb, 0, 600 - 104) context:SetFont(self.font) context:DrawText("Health: "..health.."%", 160, 600 - 72) end
  6. Thanks, it worked! Not sure why; I'll have to look at the documentation.
  7. Yes, the image is nil. I have double-checked and the path is correct and the file is still there. Furthermore, I have tried other textures and got the same result.
  8. I'm trying to draw a weapon overlay for my game; I already have the texture for it imported and in the right place, but whenever I actually draw it the game crashes. No errors, nothing. The .tex settings for it is the default except all checkboxes are unchecked and the filter mode is set to 'pixel'. Here's the part where I draw the image: local window = Window:GetCurrent() local forward = 0 local strafe = 0 local angle = 0 local weapon = 0 function Script:Create() self.w1 = Texture:Load("Materials/HUD/gun_overlay.tex") end function Script:UpdateWorld() window = Window:GetCurrent() angle = angle - dx * 0.25 forward = (window:KeyDown(Key.W) and 1 or 0)*6 - (window:KeyDown(Key.S) and 1 or 0) * 6 strafe = (window:KeyDown(Key.D) and 1 or 0)*6 - (window:KeyDown(Key.A) and 1 or 0) * 6 self.entity:SetInput(angle, forward, strafe, 0, false) end function Script:EquipBlaster()--in weapon = 1 end function Script:PostRender(context) context:SetBlendMode(Blend.Alpha) context:SetColor(1,1,1,1) if weapon == 1 then context:DrawImage(self.w1, 52, 52) end end
  9. OK, here's the project link : https://drive.google.com/file/d/0BzyMN5S2kRTHZjIxd1NUSG9BdzA/edit?usp=sharing
  10. Ok, so it turns out that method had a lot of collision bugs. I then came up with a new solution that uses the physics, and it (almost) works, but it is really weird. The physics for the player are so jittery it makes the game virtually unplayable. I don't think it's lag, either, because the frame rate is about 180! I'll put up the project in a moment; It'll take a while to upload.
  11. Found a solution. I just had to use SetPosition() instead of PhysicsSetPosition(), and then I could have physics on without the player being moved when I didn't want him to.
  12. I'm not using a character controller, I can't customize the character controller at all. I'm making a 2.5d platformer, and I'm using a rigid body for the player (without mass).
  13. ANSWERED Hi, I just bought this engine a couple of days ago. It's really nice so far, but the physics engine is kind of glitchy. There have been other posts on the physics engine, and so I am aware the developer is working on it. BUT, the game I am looking to make doesn't need any sort of physics; I just need collision. Unfortunately, I can't seem to collide with anything if the mass is set to 0. If I enable physics, I can't seem to get it to not move, and It goes through everything. SO, does anyone have an idea? *EDIT: I am using a rigid body character, not a character controller.
×
×
  • Create New...