android
  #21  
Old 10-15-2010, 06:08 PM
Brett_val's Avatar
Brett_val Brett_val is offline
Senior Member
 
Join Date: Jan 2010
Location: The Netherlands
Posts: 636
Default

Quote:
Originally Posted by ©reative View Post
Thanks! Also, someone noted that drawing an image at less than 0,0 caused the player to crash, so I'm trying to get around it by drawing only the part of that image which is visible on screen. exampleImage:draw(0, 0, 40, 40, 80, 80), which is supposed to just draw part of an image, doesn't seem to do anything; when I use it, no image is drawn. Do we know that this function actually works?
Yes it works, but I thought the API is wrong about the usage.
The first four are screen coordinates and the last two are sizes:
First two are where the upper left corner of the pic would be on screen, next two are where you want to start drawing the snip, and last two are the sizes of the snip.
I used my incredible paint skills to visualize this:

exampleImage:draw(x1, y1, x2, y2, x3, y3)
Attached Images
File Type: png Untitled.png (37.8 KB, 73 views)
__________________
this is a link to my personal homepage which I haven't
Reply With Quote

Advertisement [Remove Advertisement]

  #22  
Old 10-17-2010, 07:57 AM
delirius delirius is offline
Member
 
Join Date: Feb 2010
Posts: 131
Default

i already wrote about this in another tread.
http://www.anythingbutipod.com/forum...3&postcount=17
Reply With Quote

  #23  
Old 03-01-2011, 07:22 AM
©reative's Avatar
©reative ©reative is offline
Junior Member
 
Join Date: Jun 2010
Location: Minnesota, USA
Posts: 39
Default

Q: How do I get the opposite (negative) of a positive number? I've already tried using the NOT (~) operator, and also multiplying by -1:
Code:
print(10);
print(~10);
print(-1 * 10);
Using ~ did nothing, and multiplying by -1 caused the simulator to crash.
Reply With Quote

  #24  
Old 03-01-2011, 09:18 AM
Nohajc's Avatar
Nohajc Nohajc is offline
Junior Member
 
Join Date: Mar 2010
Location: Czech Republic
Posts: 68
Default

It shouldn't crash when you multiply.

try print(tostring(-1*10))
__________________
There was a little man...
Reply With Quote

  #25  
Old 03-06-2011, 05:16 PM
©reative's Avatar
©reative ©reative is offline
Junior Member
 
Join Date: Jun 2010
Location: Minnesota, USA
Posts: 39
Default

Q: Is there a switch statement for Lua? I googled it but wasn't convinced.
Reply With Quote

  #26  
Old 03-07-2011, 07:38 AM
Nohajc's Avatar
Nohajc Nohajc is offline
Junior Member
 
Join Date: Mar 2010
Location: Czech Republic
Posts: 68
Default

I googled the same thing some time ago, and the answer is no: there is no switch in Lua.
You'll have to use if/else...
__________________
There was a little man...
Reply With Quote

  #27  
Old 09-03-2011, 02:35 PM
©reative's Avatar
©reative ©reative is offline
Junior Member
 
Join Date: Jun 2010
Location: Minnesota, USA
Posts: 39
Question

Alright, here's another question: If you load and image as such:
Code:
test = image.load("test.jpg");
and then set a variable to that image:
Code:
myTable = {};
myTable.img = test;
is the image copied into the variable, or just a reference to it? When I tried print(myTable.imgName) I got image (0373BB80).
Thanks in advance!
Reply With Quote

  #28  
Old 09-03-2011, 02:38 PM
jbob182's Avatar
jbob182 jbob182 is offline
X-Fi2 Development Moderator
 
Join Date: Feb 2010
Location: The U.S.A.
Posts: 554
Default

I would think it is copied, so just load it directly:

myTable.img = image.load("test.jpg");
Reply With Quote

  #29  
Old 01-01-2012, 05:30 PM
©reative's Avatar
©reative ©reative is offline
Junior Member
 
Join Date: Jun 2010
Location: Minnesota, USA
Posts: 39
Question Variable format

So for the game I'm currently working on there's a variable that holds the amount of money the player has. At first it'll start out at around 500, but by the end of the game it may be in the millions. I assume I can just use an int for this (4,328,291), or should I avoid possible "max-size exceeded" issues by instead dividing the actual amount by a number and using a double (4,328.291) and converting to the actual number every time I needed to use it?
Reply With Quote

  #30  
Old 01-01-2012, 06:35 PM
jbob182's Avatar
jbob182 jbob182 is offline
X-Fi2 Development Moderator
 
Join Date: Feb 2010
Location: The U.S.A.
Posts: 554
Default

I would just use an int. In pingus, we have some rather large variables as well, though I suppose in the end, it is a personal preference.
Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 04:10 AM.