This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - someone
1
« on: July 01, 2013, 02:03:27 pm »
I tried the game but didn't understood the objective, so I looked at the code & it has no goal to reach...
Seems like a board game, but I saw there's a bug where you can try placing a chip where there's one already (plus black overrides white but you cannot do it the other way around)...
2
« on: March 26, 2013, 07:06:09 pm »
I would like to mention some games for LUA that I like: - Bobby Carrot - Nice puzzle with lovely graphics link
- Labyrinthe - Same as above (though is only in French) link
And a mention to the following games (which are games I like, though might not be as pretty as above):
3
« on: January 30, 2013, 02:36:46 pm »
You can either group the pages, one at a time (Ctrl + 4), or change the layout from the Documents "Doc" menu -> Page Layout -> Select Layout -> Layout X
4
« on: January 18, 2013, 02:52:22 pm »
5
« on: December 07, 2012, 01:56:10 pm »
For painting, there is also NSPaint, which is very complete. I feel like you didn't know about this one before starting your paint program
Nspaint is more an advanced sprite editor for Lua programmers. This one is better for doodling... By the way, you should add the possibility to save.
Anyway, nice programs ! But it seems that I can't play dodger... It only displays an orange "Game over"
Changing a validation seems to fix that issue: function on.enterKey() if beginning~=0 then over=0 beginning=0 end Before, it checked if beginning was == 1, but on function on.paint(gc) it changed that variable to 2, so the validation couldn't work afterwards...
6
« on: November 15, 2012, 07:11:36 pm »
Looking at the output, it seems that the answer to that problem is that all 3 digit numbers (starting from 100, since for example 012 is not valid as is actually a 2 digit number) minus the ternaries composed of: palindrome-1, palindrome, palindrome+1, will give an output of 1089.
So, the first palindrome is 101. That means that 100, 101 & 102 are excluded, then the second palindrome which is 111 means that 110, 111 & 112 are out, and so on until you get to 999 which excludes 998 & 999, since 1000 is a 4 digit number...
In summary there are 3 cases: * If number is palindrome, answer = 0 * If number is palindrome +/- 1, answer = 198 * else, answer = 1089
7
« on: November 15, 2012, 05:43:29 pm »
The idea is in the spoiler, i think that is all i wanna do( need to check manually all of it) Its a pretty huge print for a calc to make but i always liked things big. the idea is to see if every number mirror plus its mirror gives 1089.
rules are: The smallest number must be 103 The number must not be equally read from the beginning to the and or from the the to the beginning(If they were it wouldn't make sense to mirror them) The first number decides the biggest last number EX: if the first number is 4 the smallest last number can only be 6(allways up to 9)) or be it n+2 for the smallest. And if i'm not mistaken thats it!
Well, not every number satisfy the condition, e.g. 998 is not a palindrome (a number that is the same if read left to right or right to left). If you use the code I posted earlier (which I called "mirror()"), you can print something like in the spoiler with the following function: Define main()= Func Local i,r1,r2,minus,plus For i,100,999 r1:=mirror(i) minus:=abs(r1-i) r2:=mirror(minus) plus:=r2+minus If plus=1089 Then Disp "O Inverso de",i," é ",r1,"logo:" Disp max(r1,i),"-",min(r1,i),"=",minus Disp "O inverso de ",minus," é ",r2,"logo:" Disp r2,"+",minus,"=",plus Disp "" EndIf EndFor EndFunc
8
« on: November 15, 2012, 02:20:10 pm »
Is there any way of making this code run faster(i'm kinda newb here!)
The language is Portuguese and its says like this: 301 is the mirror for 103 then: 301-103=198 891 is the mirror for 198 then: 891+198=1089 and so on..
Something I don't understand is the criteria to stop the program. The first time you do a subtraction of abs(mirror(number)-number) and then you do the same but with an addition over and over? ( abs(mirror(number)+number) ). How many times should it go before stopping? BTW, if you create a function rather than a program, you can use the output as the next input (either with another function/program or in the Calculator). You could even place it under MyLib & have your own function: Define LibPub mirror(input)= Func ©mirror(input) mirrors "input" -> "tupni" Local flip,n,i input:=string(input) n:=dim(input) flip:=mid(input,n,1) For i,1,n-1 flip:=flip&mid(input,n-i,1) EndFor Return expr(flip) EndFunc If is only a subtraction, then sooner or later should stop in 0 (when the number is a palindrome). Something you can do using the calculator (with the code posted) could be: * Type first the number you want to use as "ans", e.g. " 103" * Type " abs(mirror(ans)-ans)" * hit enter several times until you reach 0
9
« on: November 15, 2012, 11:52:04 am »
If the goto is to repeat the process or end it, you could call the function again inside the code (recursion) or end it using a return.
10
« on: November 13, 2012, 02:07:35 pm »
I just want to point out that since you're working with numbers (and not strings), any leading zeros won't come into effect (e.g. reverse(00123) will get you "321" and not "32100" (though the zeros disappear the moment you hit enter).
Also, that program will throw an error with numbers less or equal than 0 (because of log), but I suppose that's not part of the problem of mirroring numbers...
11
« on: November 13, 2012, 01:24:19 pm »
Creating a program (either with Program Editor or LUA) should be possible to mirror the numbers
12
« on: October 16, 2012, 11:50:00 am »
Which part you don't understand? It would be best to explain what the code is & does and use it (unless there's a better way than what I posted...) rather than skip it completely just because it seems confusing. I'll explain the same code I posted earlier, if there's something that is not clear or you still don't fully understand, just ask : platform.apilevel = '1.0'
--------------- -- CONSTANTS -- --------------- -- Since the images never change, I've moved them at the beginning in order to have them as global constants. -- To store them, I've used a table, in where the key (what goes inside the brackets) matches the ASCII used for the sprites. This will greatly simplify the code when you look in the map for an specific sprite.
object = {} -- C = Cobble, D = Door, G = Grass, L = Log, S = Dirt, W = Wood, X = Black, / = RoofL, | = RoofR, @ = Window, # = Leaf, ~ = Water, ` = Shop, ' = Post object["C"] = image.new(...) object["D"] = image.new(...) object["1"] = object["D"] -- This is just a reference to the sprite above object["2"] = object["D"] -- Same as above object["G"] = image.new(...) ... object["'"] = image.new(...)
-- Also, I've separated the items that will be painted on the front in another block frontObject = {} -- L = Log, # = Leaf, frontObject["L"] = image.new(...) frontObject["#"] = image.new(...) And the explanation of the second part of the code: -------------------------------------------------------------------------------- function on.paint(gc) -------------------------------------------------------------------------------- Doors() sprites(gc, object) -- Function for painting Background sprites, needs parameter "gc" for Graphic Content functions gc:drawImage(Person,(Xcoord-1)*BlockSize,(Ycoord-1)*BlockSize) -- Character sprite sprites(gc, frontObject) -- Function for painting Foreground sprites, needs parameter "gc" for Graphic Content functions end -------------------------------------------------------------------------------- function sprites(gc, table) -------------------------------------------------------------------------------- for i = 1, #Map do -- length of table -> 10 for ii = 1, #Map[i] do -- length of row -> 10 temp = string.sub(Map[i],ii,ii) if table[temp] then -- Checks if key exists in the table before painting gc:drawImage(table[temp], BlockSize*(ii-1), BlockSize*(i-1)) end end end end
When you have a table, you can know its size if you use "#". Maybe that's the confusing part you have (since I had posted it before & you didn't included it).
13
« on: October 15, 2012, 02:28:06 pm »
Hi Augs, I would recommend you to change how you store the images, so that you can reduce lines of codes when you look at them on the map (You would need to replace "..." with the actual string, I just skip it because is to long to post). Also, you could move them out of the startup function you created & have them as global variables (well, that's it if you plan to reuse the "startup()" function to reset the game in order to skip recreating the graphics all over again...
platform.apilevel = '1.0'
--------------- -- CONSTANTS -- --------------- object = {} -- C = Cobble, D = Door, G = Grass, L = Log, S = Dirt, W = Wood, X = Black, / = RoofL, | = RoofR, @ = Window, # = Leaf, ~ = Water, ` = Shop, ' = Post object["C"] = image.new(...) object["D"] = image.new(...) object["1"] = object["D"] object["2"] = object["D"] object["G"] = image.new(...) object["S"] = image.new(...) object["W"] = image.new(...) object["X"] = image.new(...) object["/"] = image.new(...) object["|"] = image.new(...) object["@"] = image.new(...) object["`"] = image.new(...) object["~"] = image.new(...) object["'"] = image.new(...)
frontObject = {} -- L = Log, # = Leaf, frontObject["L"] = image.new(...) frontObject["#"] = image.new(...)
And then, when you are painting them, you can use the following code:
-------------------------------------------------------------------------------- function on.paint(gc) -------------------------------------------------------------------------------- Doors() sprites(gc, object) -- Background gc:drawImage(Person,(Xcoord-1)*BlockSize,(Ycoord-1)*BlockSize) sprites(gc, frontObject) -- Foreground end -------------------------------------------------------------------------------- function sprites(gc, table) -------------------------------------------------------------------------------- for i = 1, #Map do -- length of table -> 10 for ii = 1, #Map[i] do -- length of row -> 10 sprite = string.sub(Map[i],ii,ii) if table[sprite] then gc:drawImage(table[sprite], BlockSize*(ii-1), BlockSize*(i-1)) end end end end Edit: Joined functions when you paint something in the back and front of the character...
14
« on: October 01, 2012, 05:49:56 pm »
Thanks for the invitation. In general, I like to help whenever I can & have time to do so, but I wouldn't like to be counted as an active member of a team. So I would like to pass the offer.
I suppose that XMapCoord and YMapCoord will be used for "warps" to other maps (most likely using those coordinates as new points), but you'll be limited to a determined number (Currently 64 or 100, depending if you count the margins or not). Calling a map by an ID is better as you will not be limited by the squares & you still have the character's coordinates which you can then compare. Although as you say, I don't know how you plan on creating the screens (though right now looks like those Zelda games for handheld)
As for the string, I know is a local joke here, but never cared to read what is really about...
15
« on: October 01, 2012, 03:21:11 pm »
Here is a small preview of my game.
Hi Augs, I saw that some parts of the code that could be modified to read easier the code, like using "elseif" where it can be applied & adding a variable where you call the same chunk several times & so on. (There was even a crash when navigating up or down, due to being out of range in a table) I've attached a file with the changes.
|