Show Posts

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 - Zefk

Pages: [1] 2 3 ... 36
1
Development / Re: Side scrolling functionality
« on: August 11, 2018, 02:13:31 am »
I updated my post and made the side-scroling script somewhat stable: here

It is not perfect, but I could make a side-scroller game with it. I hope it helps someone out there.

Remember to credit Wrightmat because it is his script. I just patched it up.

P.S. I will just silently update the post above if I find bugs.

2
Development / Re: [Solved]Hero state question
« on: August 10, 2018, 12:32:09 am »
Ah, got it and that did fix my problem. It was quite odd because the hero would get stuck on the bow state if I pressed "b" and "down" very quickly on a ladder. Not sure if that is a bug. It could just be me.

Code: Lua
  1.          
  2.           --State is a variable in hero:set_animation()
  3.           --hero:set_animation(state)
  4.           if key == "b" then
  5.             hero:start_bow()
  6.           elseif key == "down" and state == "walking" or state == "ladder" then
  7.             hero:unfreeze()
  8.           end
  9.  

3
Development / [Solved]Hero state question
« on: August 09, 2018, 11:47:50 pm »
I was wondering if there was a way to set the hero's state? All I noticed in the documentation was hero:get_state().

Sometimes the hero gets stuck on a certain state in my scripts and something like the following would be useful.

Code: Lua
  1. hero:set_state("free")

4
Development / Re: Side scrolling functionality
« on: August 09, 2018, 01:14:13 am »
@Christopho
Ah, I had no idea.

Updated:
  • Added facing direction option when jumping
  • Added a fix for when the hero gets stuck on a ladder when using the bow
  • Added fixes for sword
  • Added fixes for tapping
  • Added fixes for running
  • Added fixes for lifting
  • Added fixes for water - needs to be converted to dynamic and named water
  • Added fixes for block
  • Added fixes for carrying destructible entities
  • Added fixes for boomerang
  • Added fixes for hookshot
  • Added fixes for opening chest
  • Added fixes for hole or falling
  • Added fake death
  • Added script and comment clean up
  • Added fixes for holding multiple keys when carrying

Download Quest: here




The thing I cannot figure out. The hero jumps faster and faster after every death. The only thing I can think of is to use a fake game:start().

Code: Lua
  1.         local map = game:get_map()
  2.         --Fake death
  3.         --map1
  4.         if game:get_value("map1") == true and map:get_id() == "first_map" then
  5.           if game:get_life() == 1 then
  6.             hero:teleport("first_map", "map1", "fade")
  7.             game:set_life(game:get_max_life())
  8.           end
  9.          --map2
  10.          elseif game:get_value("map2") == true and map:get_id() == "map_leave_test" then
  11.           if game:get_life() == 1 then
  12.             hero:teleport("map_leave_test", "map2", "fade")
  13.             game:set_life(game:get_max_life())
  14.           end
  15.         end


5
Development / Re: Side scrolling functionality
« on: August 08, 2018, 08:14:53 am »
Here is a little patch until wrightmat fixes the problem. The hero will not float and get stuck on the jumping animation. Although, it will not prevent the hero from standing still and moving when the right/down or left/down is being pressed at the same time.

Wrightmat's sidescroller script: here
Wrightmat's monster script: here



I think I heard a key on_pressing function was being made. Maybe that could fix the problem.

Patch for game:on_started():
Code: Lua
  1.   function game:on_started()
  2.    local hero = game:get_hero()
  3.     hero:set_tunic_sprite_id("main_heroes/eldran")
  4.     sol.timer.start(gravity, function()
  5.       if self:get_map() ~= nil then
  6.         -- Gravity: move entities down one pixel on every update if there's no collision.
  7.         --   (like with the ground or a platform) and hero not jumping or on a ladder.
  8.         local hero = self:get_hero()
  9.         local x, y, l = hero:get_position()
  10.         if state ~= "jumping" and self:get_map():get_ground(hero:get_position()) ~= "ladder" then
  11.           if not hero:test_obstacles(0, 1) then hero:set_position(x, (y + 1), l) end
  12.         elseif state == "jumping" then
  13.           for i = 1, jump_height do
  14.             if not hero:test_obstacles(0, -1) then hero:set_position(x, (y - 1), l) end
  15.           end
  16.           sol.timer.start(gravity * jump_height, function()
  17.             if self:is_command_pressed("right") or self:is_command_pressed("left") then
  18.               state = "walking"
  19.             else
  20.               state = "stopped"
  21.             end
  22.             --right
  23.             if self:is_command_pressed("right") and self:is_command_pressed("left") then
  24.               hero:set_animation("walking")
  25.               state = "walking"
  26.             else
  27.               state = "stopped"
  28.             end
  29.             if self:is_command_pressed("right") and self:is_command_pressed("up") then
  30.               hero:set_animation("walking")
  31.               state = "walking"
  32.             else
  33.               state = "stopped"
  34.             end
  35.             --left
  36.             if self:is_command_pressed("left") and self:is_command_pressed("right") then
  37.               hero:set_animation("walking")
  38.               state = "walking"
  39.             else
  40.               state = "stopped"
  41.             end
  42.             if self:is_command_pressed("left") and self:is_command_pressed("up") then
  43.               hero:set_animation("walking")
  44.               state = "walking"
  45.             else
  46.               state = "stopped"
  47.             end
  48.             --up
  49.             if self:is_command_pressed("up") and self:is_command_pressed("right") then
  50.               hero:set_animation("walking")
  51.               state = "walking"
  52.             else
  53.               state = "stopped"
  54.             end
  55.             if self:is_command_pressed("up") and self:is_command_pressed("left") then
  56.               hero:set_animation("walking")
  57.               state = "walking"
  58.             else
  59.               state = "stopped"
  60.             end
  61.             if self:is_command_pressed("up") and self:is_command_pressed("down") then
  62.               hero:set_animation("walking")
  63.               state = "walking"
  64.             else
  65.               state = "stopped"
  66.             end
  67.           end)
  68.           hero:set_animation(state)
  69.         end
  70.  
  71.   function game:on_key_pressed(key)
  72.     local hero = game:get_hero()
  73.  
  74.     if key == "up" and key == "down" and key == "left" and key == "right"  then
  75.       hero:set_animation("walking")
  76.     else
  77.       hero:set_animation("walking")
  78.     end
  79.   end

Explanation:

I added some checks function game:on_started() to prevent the hero from floating around.

Code: Lua
  1.             --right
  2.             if self:is_command_pressed("right") and self:is_command_pressed("left") then
  3.               hero:set_animation("walking")
  4.               state = "walking"
  5.             else
  6.               state = "stopped"
  7.             end
  8.             if self:is_command_pressed("right") and self:is_command_pressed("up") then
  9.               hero:set_animation("walking")
  10.               state = "walking"
  11.             else
  12.               state = "stopped"
  13.             end
  14.             --left
  15.             if self:is_command_pressed("left") and self:is_command_pressed("right") then
  16.               hero:set_animation("walking")
  17.               state = "walking"
  18.             else
  19.               state = "stopped"
  20.             end
  21.             if self:is_command_pressed("left") and self:is_command_pressed("up") then
  22.               hero:set_animation("walking")
  23.               state = "walking"
  24.             else
  25.               state = "stopped"
  26.             end
  27.             --up
  28.             if self:is_command_pressed("up") and self:is_command_pressed("right") then
  29.               hero:set_animation("walking")
  30.               state = "walking"
  31.             else
  32.               state = "stopped"
  33.             end
  34.             if self:is_command_pressed("up") and self:is_command_pressed("left") then
  35.               hero:set_animation("walking")
  36.               state = "walking"
  37.             else
  38.               state = "stopped"
  39.             end
  40.             if self:is_command_pressed("up") and self:is_command_pressed("down") then
  41.               hero:set_animation("walking")
  42.               state = "walking"
  43.             else
  44.               state = "stopped"
  45.             end

I added this function to prevent the hero from being stuck on the jumping animation.

Code: Lua
  1.   function game:on_key_pressed(key)
  2.     local hero = game:get_hero()
  3.  
  4.     if key == "up" and key == "down" and key == "left" and key == "right"  then
  5.       hero:set_animation("walking")
  6.     else
  7.       hero:set_animation("walking")
  8.     end
  9.   end

6
Development / Re: Side scrolling functionality
« on: August 08, 2018, 02:40:59 am »
I found a bug when holding down keys.  The hero glides around if I continue to hold the up and right keys at the same time and the hero retains the jump animation if I were to jump while holding the keys.

You can see it near the end of the gif. Ignore the water....I was testing something with a black tile.

7
General discussion / Re: Free Pixel Art Making Programs
« on: August 07, 2018, 09:54:58 pm »
@froggy77
Added it. Those are some nice tutorials.

8
Your projects / Re: New Debian/Ubuntu Package Location
« on: August 07, 2018, 07:32:45 am »
@Nate-Devv

I have to say thanks for the Ubuntu version! I use it all the time.

9
Your projects / Re: Book Alpha Release
« on: August 03, 2018, 07:55:29 am »
Okay, this is still experimental, but here it is the book!

You can find everything in Github release. The pdf is in the "book" directory.

Github Alpha Release: Here
Website: Here

Please report any errors/suggestions here or on Github and see new commits for fixes

10
Bugs & Feature requests / Re: [Solved]on_removed() warning issue?
« on: July 28, 2018, 07:20:20 pm »
@Diarandor
Ah, I get it now. Thanks for clarifying Diarandor.

Since this is no way a bug. I will mark it as solved.

11
Bugs & Feature requests / Re: on_removed() warning issue?
« on: July 28, 2018, 02:30:00 am »
@Max
I think enemy:on_dead() is a better solution, but I still find it odd.

12
Bugs & Feature requests / [Solved]on_removed() warning issue?
« on: July 28, 2018, 12:48:17 am »
To begin with, this issue does not affect the game play at all and everything works. It is just an annoying warning.

I have this code on a different map.
Code: Lua
  1.   function slime:on_removed()
  2.     bookcase:set_enabled(false)
  3.   end

When I leave the map and go to a different map, I get a warning from the previous map: (I checked and "bookcase" does not exist on the new map.)
Code: [Select]
Error: In on_removed: [string "maps/chain_village/zark_house.lua"]:17: attempt to index global 'bookcase' (a nil value)
Please note: I did not remove the bookcase and it does the same thing when I tested it with a chest entity.

Code: Lua
  1.  function slime:on_removed()    
  2.     if not chest:is_open() then
  3.       sol.audio.play_sound("secret")
  4.     end
  5.  end

Code: [Select]
Error: In on_removed: [string "maps/chain_village/zark_house.lua"]:21: attempt to index global 'chest' (a nil value)

I get around the warning by using a save variable.

Code: Lua
  1.   function slime:on_removed()
  2.     if not game:get_value("zark_house_enemy_defeated") == true then
  3.       bookcase:set_enabled(false)
  4.     end
  5.    
  6.     if not game:get_value("zark_house_enemy_defeated") == true then
  7.       if not chest:is_open() then
  8.         sol.audio.play_sound("secret")
  9.       end
  10.     end
  11.  
  12.     game:set_value("zark_house_enemy_defeated",true)
  13.   end

13
Bugs & Feature requests / Re: [Solved]door function issue?
« on: July 26, 2018, 08:30:16 pm »
@Christopho
No loop, but it seems the "opening" frame delay was the problem. The frame delay was at: 0 ms

It works now. Thank you Christopho!

14
Development / Re: Required Sound Effects?
« on: July 26, 2018, 08:20:14 pm »
Well, this is just a hunch, but did you check the project_db.dat?

They probably still exist there if you did not delete the sounds from the editor.

15
Bugs & Feature requests / Re: door function issue?
« on: July 26, 2018, 07:51:01 pm »
I am pretty sure. Here is an image to prove it. I made sure all the animations existed as stated in the documentation.



Also, I mentioned the function door:is_opening() working.

Code: Lua
  1.  
  2. sol.timer.start(1000, function()
  3.   if door_1:is_opening() == true then
  4.     hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
  5.   end
  6.   return true
  7. end)
  8.  


Pages: [1] 2 3 ... 36