Jump to content

juanqg

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by juanqg

  1. Hi, I'm just getting started with leadwerks, sorry if this is not the right thread for my question. I'm following the tutorials particularly Jorn's Videos, so far very straightforward! Thank you for the great work! Here's my question; While following the videos for the Saturn Project (I believe that at video 11) Jorn started the concept of drawing the 2d / overlay, the boxes for health and health calculation are working fine but they're all black (including the draw texture!) they are shown just as black squares, the health bar did updated as expected but just the a black bar is reduced. I'm not pasting the actual "Script" tab here but I did choose the color and even if that were the issue what about the Texture then, why is black as well? Since I'm sure I'm missing something here, it is important to note that I'm using the Steam Version of LeadWerks, also I started the project from scratch, so maybe there is some setting (Perhaps at the World initialization) that I completely missed, the demo works fine the barrels falling, the collision, the door, etc. I could't figure out how to paste an screenshot here, so here is a piece of code is long so I'm going to thank you here for checking!: Script.size = Vec2(160, 25) --Vec2 "Size" Script.backgroundColor = Vec4() --color "Background Color" Script.healthBarColor = Vec4() --color "Health Bar Color" Script.player = nil Script.overlayPath = "" --path "Overlay" "Tex file (*tex):tex" Script.overlay = nil function Script:Start() self.player = self.entity:GetParent() if self.overlayPath ~= "" then self.overlay = Texture:Load(self.overlayPath) end end function Script:PostRender(context) -- Background local color = Vec4( self.backgroundColor.x / 255, self.backgroundColor.y / 255, self.backgroundColor.z / 255, self.backgroundColor.w / 255) context:SetColor(color) context:DrawRect(0,context:GetHeight() - (self.size.y * 2), self.size.x, self.size.y) -- HealthBar local healthFactor = self.player.script.health / self.player.script.maxHealth local color = Vec4( self.healthBarColor.x / 255, self.healthBarColor.y / 255, self.healthBarColor.z / 255, self.healthBarColor.w / 255) context:SetColor(color) context:DrawRect(400,context:GetHeight() - (self.size.y * 2), self.size.x * healthFactor, self.size.y) -- Draw Overlay if self.overlay ~= nil then context:DrawImage(self.overlay, 0, 0, 50, 30) end end
×
×
  • Create New...