Recent Posts

Pages: [1] 2 3 ... 10
1
Your projects / Re: Designing the overworld of my quest.
« Last post by wrightmat on June 26, 2017, 06:36:18 pm »
I would work on blending your styles some. The difference between the LttP style and the other is quite jarring. Otherwise I really like the layout of your maps - good work!
2
Development / Re: Zelda Roth Reproduced Intro Help
« Last post by Diarandor on June 26, 2017, 12:12:51 pm »
Probably, but I am not sure if that is the same thing, and also I don't know which license has that code (it could be incompatible with GPL).

Anyway, you cannot directly add a library without coding something in the engine (the C++ part).
3
Your projects / Re: iOS port
« Last post by vlag on June 26, 2017, 10:29:06 am »
Thanks ! :)


However unfortunately nobody seems to be interested in such a port, the package is still untested :P

I guess you should have more success with an Android port regarding the Solarus community. Now that touch events are handled in the engine and the ZMC quest includes features for virtual buttons, you should be able to build an Android test package without changing anything in both source codes (or a very few things in the quest code, basically changing an "if iOS" into "if iOS or Android")
5
Development / Re: Zelda Roth Reproduced Intro Help
« Last post by Diarandor on June 26, 2017, 02:14:38 am »
To do that zoom with that camera angle we may need something like this: https://en.wikipedia.org/wiki/Mode_7
Or maybe just a normal zoom (maybe this can already be done).

I don't remember if there are already requests for these features in github.
6
Development / Re: Trouble porting a script
« Last post by llamazing on June 25, 2017, 10:05:02 pm »
Do  you have a sample project available? It's a bit hard to troubleshoot from the forum.

Also double-check that I negated those if statements correctly.
7
Development / Re: Trouble porting a script
« Last post by MetalZelda on June 25, 2017, 09:44:27 pm »
This kinda work, it is better than last time because now the cursor and item change.

However, this is messy, it only loops through 2 items, the distance system works but it only loops between 2 items, light be the command stuff but it looks ok ...

Code: Lua
  1. function submenu:set_cursor_position(command)
  2.   local width = sol.video.get_quest_size()
  3.   width = width / 2 - 160
  4.  
  5.   local current_x = self.cursor_position.x
  6.   local current_y = self.cursor_position.y
  7.        
  8.   -- Create default value for the closest item's distance
  9.   local closest_index = -1
  10.   local closest_distance = 9999999
  11.   local index = self:find_item(self:find_item_axis(current_x, current_y))
  12.        
  13.   -- Initialize variables for the weightings on the vertical and horizontal direction
  14.   local wv, wh = 0, 0
  15.        
  16.   -- The weightings for the secondary and primary axis relative to input
  17.   local w1, w2 = 1, 2
  18.        
  19.   -- Setup the weightings for each direction
  20.   if  (command == "down" or command == "up") then
  21.     wv, wh = w1, w2
  22.   elseif (command == "left" or command == "right") then
  23.         wv, wh = w2, w1
  24.   end
  25.  
  26.   for i, item in ipairs(self.items) do
  27.     local x = item.x
  28.         local y = item.y
  29.        
  30.         --  This isn't the old item or the opposite direction
  31.         if index ~= i or (command ~= "down" and y > current_y) or (command ~= "left" and x < current_x) or (command ~= "right" and x > current_x) or (command ~= "up" and y < current_y) then
  32.           -- Get the distance of the current item and the new one
  33.           local dist_h = math.abs(x - current_x)
  34.           local dist_v = math.abs(y - current_y)
  35.          
  36.           if (wh ~= w1 or w2 * dist_h > dist_v) and (wv ~= w1 or w2 * dist_v > dist_h) then
  37.             local dist = (dist_h * wh + dist_v * wv)
  38.                
  39.                 -- Set at closest item if appropriate
  40.             if (dist < closest_distance) then
  41.                   closest_distance = dist
  42.                   closest_index = i
  43.             end
  44.           end    
  45.         end
  46.   end
  47.  
  48.   local item = self.items[closest_index]
  49.   local x = item.x
  50.   local y = item.y - 5 
  51.        
  52.   self.cursor_position = {x = x, y = y + 5}
  53.   self.cursor_sprite_x = x + width
  54.   self.cursor_sprite_y = y
  55.   self.game:set_custom_command_effect("action", item.effect)
  56.  
  57.   local caption_item = item.item .. "_" .. self.game:get_item(item.item):get_variant()
  58.  
  59.   self:set_caption(self.caption_text_keys[caption_item])  
  60.   self.game:set_value(self.menu .. "_last_index", tostring(x) .. "," .. tostring(y + 5))
  61. end

index prints the right item index in the array so this is not the culprit there
Hmmm, that's the 1st time a ruby script port grinds my gears
8
Development / Re: Zelda Roth Reproduced Intro Help
« Last post by Tulk on June 25, 2017, 08:26:43 pm »
Thank you guys! xD


--------- @Edit:

How can I reproduce something like in this video: 1:34 - 1:38

https://www.youtube.com/watch?v=3Jm8_1zoZtw&list=PLaT85v0g5RS6Lshz4RUNGF8bpNqZHsmuM

The camera approaches on point of image on the screen in game intro. How to make it?
9
Development / Re: Trouble porting a script
« Last post by llamazing on June 25, 2017, 06:41:04 pm »
There isn't an equivalent to next in lua, but you can accomplish the same thing using if statements. Take the two simplified examples (using lua syntax for illustration purposes)

Code: Lua
  1. for i = 1, #self.items do
  2.     if index == i then
  3.         next --not valid lua
  4.     end
  5.    
  6.     print("not skipped")
  7. end

Code: Lua
  1. --equivalent to the following
  2. for i = 1, #self.items do
  3.     if index ~= i then
  4.         print("not skipped")
  5.     end
  6. end

So in your for block you could do the following in lua (note I have not tested it so there may be errors):
Code: Lua
  1. for i,item in ipairs(self.items) do
  2.     local item_x = item.x
  3.     local item_y = item.y
  4.     local current_item_index = self:find_item(self:find_item_axis(self.cursor_position.x, self.cursor_position.y))
  5.    
  6.     --  Skip if it is the old item or is in the opposite direction
  7.     if current_item_index ~= i and (command ~= "down" or item_y >= current_y) and (command ~= "left" or item_x <= current_x) and (command ~= "right" or item_x >= current_x) and (command ~= "up" or item_y <= current_y) then
  8.         -- Get the distance of the current item and the new one
  9.         local dist_h = math.abs(item_x - current_x)
  10.         local dist_v = math.abs(item_y - current_y)
  11.        
  12.         if (wh ~= w1 or w2 * dist_h >= dist_v) and (wv ~= w1 or w2 * dist_v >= dist_h) then
  13.             -- # Get the distance multiplied with their weightings
  14.             local dist = (dist_h * wh + dist_v * wv)
  15.        
  16.             -- # Set at closest item if appropriate
  17.             if (dist < closest_distance) then
  18.                 closest_distance = dist
  19.                 closest_index = i
  20.             end
  21.         else
  22.             --equivalent to next, do nothing this iteration
  23.         end
  24.     else
  25.         --equivalent to next, do nothing this iteration
  26.     end
  27. end

Also note that instead of doing
Code: Lua
  1. for i = 1, #self.items do
  2.     local item = self.items[i]
  3.     ...
  4. end

it is better to use
Code: Lua
  1. for i,item in ipairs(self.items) do
  2.     ...
  3. end
10
Development / Re: Trouble porting a script
« Last post by Maxs on June 25, 2017, 06:35:43 pm »
I don't think that there are a Lua equivalent to the next statement of Ruby, but you can easily reproduce this with a variable.

For example :

Code: Ruby
  1. for i in 0...@xy_pos.size
  2.   if (condition)
  3.      next
  4.   end
  5.   # rest of the code
  6. end
  7.  

becomes :

Code: Lua
  1. for i = 1, #items do
  2.   local to_next = false
  3.   if (condition) then
  4.      to_next = true
  5.   end
  6.  
  7.   if not to_next then
  8.     -- rest of the code
  9.   end
  10. end
  11.  
Pages: [1] 2 3 ... 10