android
  #1  
Old 04-16-2010, 11:43 AM
jimmyjoe36's Avatar
jimmyjoe36 jimmyjoe36 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 12
Default leamonade tycoon

hi im starting to try to have a go making leamonade tycoon but havent programed very much lua apps. i was wondering how you would make the little people in the game move???????? plus does any other more experenced programmers want to help????????
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 04-16-2010, 11:58 AM
lsquish's Avatar
lsquish lsquish is offline
Junior Member
 
Join Date: Mar 2010
Posts: 47
Default

well, making lemondae tycoon would be a very hard challenge.
But i will help you all i can so, you say you wanted the people to move around.
Here's a simple script for 1 person.





width=screen.width()
height=screen.height() --set the screensize


imageofperson=image.load("icon.png") --load the image of person


white=color.new(255,255,255)--this is the colour white

randomn=0 --this is the variable that decides wehter he moves left, right....
person1X=200 --the persons X coridantes
person1Y=120 --the persond Y coridantes


function drawgame()
screen.fillrect(0,0,width,height,white); --draw the background
imageofperson:draw(person1X,person1Y) -- draw the person
screen.update()
end

while true do -- forever
randomn=math.random(1,4) --set random to 1,2,3or4
if randomn==1 then --move right
person1X=person1X+10
end
if randomn==2 then -- move left
person1X=person1X-10
end
if randomn==3 then --move up
person1Y=person1Y-10
end
if randomn==4 then --move DOWN
person1Y=person1Y+10
end
drawgame() --excutes the function drawgame()
os.sleep(50) --wait a bit
end

Last edited by lsquish; 04-16-2010 at 12:06 PM.
Reply With Quote

  #3  
Old 04-16-2010, 12:17 PM
jimmyjoe36's Avatar
jimmyjoe36 jimmyjoe36 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 12
Default

thanks this what ive got so far

menu=image.load("images/menu.jpg")

function menu()
bg:draw(0,0)
screen.update()
os.sleep(200)
end

height = screen.height()
width= screen.width()
local black = color.new(0,0,0)
local colorWhite = color.new(255, 255, 255);

--load image
print("load images")
Reply With Quote

  #4  
Old 04-16-2010, 12:30 PM
lsquish's Avatar
lsquish lsquish is offline
Junior Member
 
Join Date: Mar 2010
Posts: 47
Default

Quote:
Originally Posted by jimmyjoe36 View Post
thanks this what ive got so far

menu=image.load("images/menu.jpg")

function menu()
bg:draw(0,0)
screen.update()
os.sleep(200)
end

height = screen.height()
width= screen.width()
local black = color.new(0,0,0)
local colorWhite = color.new(255, 255, 255);

--load image
print("load images")


whats the "print("load images")"
if you want to draw a image you must have:
name of the image:draw(X position,Yposition)

Can you explaing exactly what you are trying to do
Reply With Quote

  #5  
Old 04-16-2010, 12:42 PM
jimmyjoe36's Avatar
jimmyjoe36 jimmyjoe36 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 12
Default

tryin to load the menu background
Reply With Quote

  #6  
Old 04-16-2010, 12:52 PM
jimmyjoe36's Avatar
jimmyjoe36 jimmyjoe36 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 12
Default

this the menu
Attached Images
File Type: jpg menu.jpg (28.9 KB, 92 views)
Reply With Quote

  #7  
Old 04-16-2010, 12:59 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

Quote:
Originally Posted by jimmyjoe36 View Post
tryin to load the menu background
Code:
menu:draw(0,0,width,height)
This draws the image "menu" which you have loaded with:
Code:
menu=image.load("images/menu.jpg")
From x=0, y=0 to the screen width and height, thus filling the screen with the image.

(Also, the image cannot exceed 400x240 pixel)
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #8  
Old 04-17-2010, 03:33 AM
Zaffo Zaffo is offline
Junior Member
 
Join Date: Mar 2010
Location: Holland
Posts: 21
Default

I think it's better to use PNG images instead of JPEG. As with PNG every pixels has it's own color, while with JPEG you get blurry blech bla..... horrible text, as you can see in the menu image. Use the original source to save this image as .png

As Habhome says. The screen of the X-Fi2 is 400x240 pixels, using a background image with dimensions 480x320 isn't optimal. But I guess the Zen can work with it, it either runs out of screen space giving you a incomplete menu or the image has to be scaled down which is pointless.

But the start looks nice. I can't wait to play this game.
__________________
Snake for the X-Fi2
Reply With Quote

  #9  
Old 04-17-2010, 06:09 AM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

I think we established a while ago that if the image exceeds 400x240 the application crashes. If I remember correctly that is.
I'd also suggest .PNG, for the reasons stated by Zaffo.

And on a note of animations. You don't need to make the game exactly like the original where you can see the people move about. I've played another version of this which is completely text/image based, and it's really fun.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #10  
Old 04-17-2010, 02:01 PM
jimmyjoe36's Avatar
jimmyjoe36 jimmyjoe36 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 12
Default

do u have a link to it plz
Reply With Quote

  #11  
Old 04-17-2010, 02:42 PM
Habhome's Avatar
Habhome Habhome is offline
Moderator
 
Join Date: Jan 2010
Location: Sweden
Posts: 1,079
Default

Quote:
Originally Posted by jimmyjoe36 View Post
do u have a link to it plz
http://www.funplanet.se/ go to "spel" then "safteriet". It's a version of it, very simple. And all in Swedish.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine
Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it!
Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it.
Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^
Reply With Quote

  #12  
Old 04-18-2010, 08:03 AM
jimmyjoe36's Avatar
jimmyjoe36 jimmyjoe36 is offline
Junior Member
 
Join Date: Feb 2010
Posts: 12
Default

thanks its alot simpler
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 01:28 AM.