Jump to content

[SOLVED]need help with some code


swipis
 Share

Recommended Posts

ok, I doing tutorial and now I got an error "attempt to index field 'context'(a nil value)" in Start function

here is the code

Script.itemSlots = 4 --int "Item Slots"
Script.itemSize = Vec2(64,64) --Vec2 "Item Size"
Script.offset = 8.0 --float "Offset"
Script.items = {}
Script.screenWidth = 0
function Script:Start()

self.screenWidth = App.context:GetWidth()

end
function Script:PostRender(context)
for i = 1, self.itemSlots, 1 do

context:SetColor(1,1,1,1)
local x = self.screenWidth - self.itemSize.x
local y = (i * self.itemSize.y) + (i * self.offset)
context:DrawRect(x, y, self.itemSize.x, self.itemSize.y)

end
end

 

please help smile.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...