Well, the subject might have definitely caught your attention. I was thinking about a piece of code that I saw and I could not help but think that if there was porn for a coder, what would it look like, and then it hit me, this is what it would look like.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | function obj:touch(event) print("touch event") print("event("..event.phase) if(event.phase == "ended") then self.touched = self.touched-1 print("Se acabo el movimiento") if(self.touched == 0) then print("Touchs "..self.touched) self.speedX = 0 end end if(event.phase == "began") then if(self.touched == 0 ) then if(event.x>self.x) then self.touched = self.touched+1 self.speedX = 300 end if(event.x<=self.x) then self.touched = self.touched+1 self.speedX = -300 end print("Touchs "..self.touched) end end Runtime:addEventListener("touch", obj) |
Ha ha ha... I have seen this code somewhere.... where did u get this from ? from any sample code ?
I picked it up from some user, and I think you had re-written the same for all those touches and self.touch
cheers,
?:)
yea right right now I remember... hey did you notice my code is more funny. :)
I found this amusing, it's actually quite clever. Good post :)