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

Pages: [1]
Development / Re: Detecting when a pickable is picked up
« on: August 06, 2017, 09:11:13 am »
Ah, right. I've been doing to much GML lately.
Also, I've realized that I've been going about this all wrong. I should be using map:on_obtained_treasure(treasure_item, treasure_variant, treasure_savegame_variable) instead.

Development / Re: Detecting when a pickable is picked up
« on: August 05, 2017, 11:07:27 am »
Oh, boy. I think at some point I might need to move this to bug reports. The if not card and cardchecked doesn't remove the pointer, changing it to if not card:exists() and cardchecked both spams the console and doesn't remove the pointer, and I'm just not sure if erroring while trying to index a value for entity:exists() is exactly the best thing because if it can't find the entity then it's doing its job. If there's something huge I'm missing here, please let me know, but I'm just not sure what's going on with this anymore.

Development / Re: Detecting when a pickable is picked up
« on: August 05, 2017, 11:00:01 am »
A friend and I looked the code over and realized what was wrong. It was erroring saying card was a nil value without it being map.card, but only after I picked the card up. To fix that, I added in stops for the loop:
Code: Lua
  1. function map:on_update()
  2.   if not card and cardchecked then
  3.     cardpoint:remove()
  4.     print("Card removed!")
  5.     cardchecked = true
  6.   end
  7.   if not gem and gemchecked then
  8.     gempoint:remove()
  9.     print("Gem removed!")
  10.     gemchecked = true
  11.   end
  12. end
So the error doesn't spam anymore. However, it won't do the gempoint:remove() still. Do I need to do something to gempoint to make it work properly?

Development / Re: Detecting when a pickable is picked up
« on: August 05, 2017, 10:44:52 am »
For a quick note, this happens if it's just card:exists() as well, so it isn't the map.card that's the issue.

Development / Detecting when a pickable is picked up
« on: August 05, 2017, 08:27:14 am »
I have two pickable items named card and gem and I want to be able to tell when they're picked up and make pointers over each item disappear. I'm using this script to do that:
Code: Lua
  1. function map:on_update()
  2.   if not map.card:exists() then
  3.     cardpoint:remove()
  4.     print("Card removed!")
  5.   else if not map.gem:exists() then
  6.     gempoint:remove()
  7.     print("Gem removed!")
  8.   end
  9.   end
  10. end
However, when I do that, it errors Error: In on_update: [string "maps/street_arspace.lua"]:79: attempt to index field 'card' (a nil value), line 79 being if not map.card:exists() then. Any suggestion for what I'm doing wrong?
It also for some reason doesn't work without that extra end there. I'm not sure what's up with that.

Development / Re: Adding WASD control in tandem with arrow keys
« on: July 30, 2017, 01:49:33 am »
Much better. Thank you!!!

Development / Adding WASD control in tandem with arrow keys
« on: July 29, 2017, 07:56:54 am »
I'm working on making a game with Solarus and I want the WASD keys to be usable for moving the character alongside the arrow keys, kinda like how you can use the demo mouse_control script and the arrow keys at the same time. Is this possible to do? I've tried making a script off of the mouse_control one but it isn't seeming to work. It doesn't help that d is a pause key, apparently. If anyone can point out where I messed up, I'd love to know. Thanks!

Code: Lua
  1. require("scripts/multi_events")
  4. local function initialize_wasd_control_features(game)
  6.   local wasd_control = {}
  8.   local is_key_pushed = false
  9.   print("wasd control startup")
  11.   -- Movement of the hero.
  12.   local directions_pressed = {
  13.       right = false,
  14.       up = false,
  15.       left = false,
  16.       down = false
  17.   }
  19.   function wasd_control:on_key_pressed(key)
  20.     is_key_pushed = true
  22.   end
  24.   function wasd_control:on_mouse_released(keu)
  26.     is_key_pushed = false
  27.     pressed_key = key
  28.   end
  30.   function wasd_control:on_update()
  32.     local map = game:get_map()
  33.     if map == nil then
  34.       return
  35.     end
  37.     if is_key_pushed then
  39.       pressed_right = sol.input.is_key_pressed("d")
  40.       pressed_up = sol.input.is_key_pressed("w")
  41.       pressed_left = sol.input.is_key_pressed("a")
  42.       pressed_down = sol.input.is_key_pressed("s")
  44.       self:update_direction("right", pressed_right)
  45.       self:update_direction("up", pressed_up)
  46.       self:update_direction("left", pressed_left)
  47.       self:update_direction("down", pressed_down)
  48.     else
  50.       for direction, _ in pairs(directions_pressed) do
  51.         self:stop_direction(direction)
  52.       end
  53.     end
  54.     function wasd_control:start_direction(direction)
  56.       if not directions_pressed[direction] then
  57.         directions_pressed[direction] = true
  58.         game:simulate_command_pressed(direction)
  59.       end
  60.     end
  62.     function wasd_control:stop_direction(direction)
  64.      if directions_pressed[direction] then
  65.         directions_pressed[direction] = false
  66.         game:simulate_command_released(direction)
  67.       end
  68.     end
  69.   end
  70. end
  71. local game_meta = sol.main.get_metatable("game")
  72. game_meta:register_event("on_started", initialize_wasd_control_features)
  73. return true

Bugs & Feature requests / Re: More tile ground types
« on: July 15, 2017, 09:50:47 am »
Ohhhhhhhh. Okay. The look of the tile preview to be half-wall and half-terrain confused me. Sorry!

Bugs & Feature requests / Re: More tile ground types
« on: July 14, 2017, 12:43:15 pm »
I'm splitting the ones I want to have as partial traversible tiles into separate tiles, but it takes the number of total tiles from 48 to 84, and it makes things excessively complex if I decide I want to move things around. For reference, I've attached images a map using the tiles and the tilesheet itself, with tile hitboxes shown. Optimally, each tile would just be a square, with specific terrain that dictates what parts of the tiles can be walked on, instead of having to split each full tile into smaller pieces to do it.

Bugs & Feature requests / Re: More tile ground types
« on: July 14, 2017, 10:06:39 am »
Low walls are exactly what I want, but there's just a problem with them: there are only low walls in one direction. I can't have them covering just the left half of the tile or just the right half of the tile, only covering just the bottom half.

Bugs & Feature requests / More tile ground types
« on: July 13, 2017, 10:00:48 am »
I'm making a road in my project and I want the sides of the road to be half-traversible, half-wall. However, the only half-traversible tile grounds are corners and low wall. I want something like low wall, but for the top, left, and right as well. Would that be possible to do, and do you think it might be possible to be able to make custom tile hitboxes in the engine as well? It'd be really neat to be able to craft your own ground types by polygon out of the basic types.

Pages: [1]