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

Pages: [1] 2 3 ... 6
Your projects / Re: Zelda's Adventure: Solarus Edition
« on: May 26, 2018, 04:44:04 pm »
I noticed something else in your code- the movement creation isn't inside any function, and it looks like you have an extra "end" after the code that has to do with the movement. I'd put the movement stuff in map:on_started()

Your projects / Re: Zelda's Adventure: Solarus Edition
« on: May 20, 2018, 02:58:13 am »
Hey, just a question, what was the problem with your octorocks/what did you do to fix them? I've had a similar problem.

Your projects / Re: Ocean's Heart
« on: May 19, 2018, 08:58:35 pm »
Just thought I'd post to say progress is going well, I'm deep into building out the next major area, half of its main quests are done, as is the mapping. This area is coming along nicely so I thought I'd do a screenshot before I rush off to work. Thanks for following!

Development / Re: Switch between two sprites by pressing a key?
« on: May 17, 2018, 05:59:00 pm »
One thing you could try is going into your main.lua script. There's some lines in there that handle key presses, I think the function is sol.main:on_key_pressed? Something like that. Anyway, that handles special keys, you can see there the format is stuff like, if key==f5 do this, if key ==escape, do this. You'll want some code like:

If key == "w" then
If game:get_ability("tunic") == 1 then game:set_ability("tunic", 2)

And vice versa. If you're still not familiar enough with Lua to notice, what I typed is not correct code (there are no "end"s for the conditional branches), so don't try copy/pasting or it'll just give you errors, haha, but that's the general idea which I think should work. You can look those methods up in the Solarus documentation and ask more questions of you don't understand them : )

Development / Re: How to create entity over hero?
« on: May 08, 2018, 09:39:16 pm »
I'm not 100% sure how y-order works, but would you maybe want the entity to follow the hero's coordinates, but Y+1 so it's slightly "lower"/south/in-front-of the hero?

Your projects / Re: Ocean's Heart
« on: May 04, 2018, 09:13:45 am »
Small update to the current demo! Watching Christopho's let's play, as well as my wife test-playing last night, alerted me to a small handful of bugs that I've dealt with.

I've also tweaked some of the damage and life for enemies in the second half of the demo to make them a bit tougher. I might need to go in and make a bit more armor available, but if you play, let me know what you think about the enemy difficulty!

Latest Build (google drive download)

Your scripts / Re: Deku/Turret Type Enemy
« on: May 04, 2018, 06:20:06 am »
Hey, thanks for showing me! Those look great, they work really well in narrow corridors. It might be a nice scenario to have where there's a narrow corridor with little cubbies on the side you have to duck into the avoid the projectiles and time your dashes in between them. Your deku looks like you can pretty reliably hit him right before he ducks, I don't know if you experimented with the min_range property, but if you want them to duck a bit sooner, you can increase that. Or maybe you have it right where you want it, I don't know : )

For making the enemy non traversable, try experimenting with enemy:set_traversable(false), maybe just when it's "asleep" in case you'd want it to be able to damage the player when it's awake. That might work better than a wall.

I was also having problems with showing a waking up animation. I think tying it to a timer might have been a bad idea, probably something using the event sprite:on_animation_finished() somewhere within function enemy:wake_up() would be better. Probably within the conditional branch "if properties.waking_animation ~= nil then"... Maybe something like this:

Code: Lua
  1. if properties.waking_animation ~= nil then
  2.   function sprite:on_animation_finished()
  3.     self:finish_waking_up()
  4.   end
  5. else
  6.   self:finish_waking_up()
  7. end

I thiiiiiink that might work but I literally just wrote that here instead of doing any testing whatsoever, so...

Also, I kind of have a demo out now, check out my game's topic in the forum, there should be a link in the top post. I suppose it's a bit more like an open beta than a demo, because I keep uploading patches. But anyway! I'm planning on putting a new version of the demo out tonight or tomorrow morning that addresses a handful of bugs that I saw in Christopho's let's play, as well as a playtest my wife did last night instead of sleeping, haha.

Your projects / Re: Zelda's Adventure: Solarus Edition
« on: May 04, 2018, 06:05:39 am »
The strange thing is, when I first did it, it worked fine. After moving the map into a different folder, it stopped working. There's nothing else wrong with the script, it doesn't throw out any errors or anything, it just doesn't give the proper response.

One thing I noticed looking at your github is that your maps seem to be organized really different from mine. In my "data" folder, I have a "maps" folder (also "enemies", "entities", "fonts", etc...), and every map is in there. It seems like yours are in folders scattered throughout your "data" folder? I don't know how the engine reads maps, but I'm pretty sure when I specify a map in code, the engine assumes they're in a folder called "maps", because I don't think I usually specify that.

Your projects / Re: Zelda's Adventure: Solarus Edition
« on: May 04, 2018, 04:36:44 am »
What's the text of the NPCs? If you aren't using the right syntax within your dialogs, the choices don't work with their ALTTP dialog script. For example, here's a sample dialog:


Did you like your dinner?
$? Yes
$? No


I'm glad it was tasty... NOW PREPARE TO DIE!
I poisoned it!!


Oh no, was it because it was POISONED!?

So your map script would have:

Code: Lua
  2. function sample_guy:on_interaction()
  4. game:start_dialog("_npcs.sample_guy.1", function (answer)
  6. if answer == 2 then
  7. game:start_dialog("_npcs.sample_guy.2")
  9. else
  11. game:start_dialog("_npcs.s.sample_guy.3")
  13. end)
  15. end

Don't copy/paste that without checking for typos, I typed this on mobile and autocorrect is zealous.

I don't think you would ever have something like if answer == 6 because the answer is relative to the choice's line in the box, not in the whole text string. So it'll always be 1-4.

It looks like you're using the whole pause system from the Solarus team's games, which I don't understand fully, so I can't help there : /

Development / Re: Creating a respawn point on map changed?
« on: May 03, 2018, 11:10:06 pm »
Okay, that makes sense. Do you know how I can get the staircase teleporters to notify my script? The only way I can think of it map:get_entities by type, getting spiral staircase types, and comparing all their coordinates to the hero's coordinate, and if any are the same, having a conditional branch that set the respawn x-value to +-16.

But that seems like an inordinately difficult way to do it, but is that the only way?

Development / Re: Creating a respawn point on map changed?
« on: May 03, 2018, 09:17:48 pm »
Hey! So I thought this script was working out all great and fine, but I've encountered an issue. If you use any of the "spiral staircase" modifiers to your teleports, you can get stuck in a wall if you respawn.

The problem is this- the spiral staircase things work like this I think: they change the behavior of your teleport, so that instead of going right to the destination, the put you 16px to the right or left of your destination (in a wall), then the engine automatically moves the hero into the destination then down 16px while playing an animation to simulate the staircase thing.

The problem comes if you die in the room you entered by staircase. Since that's your respawn map, this script will send you back to wherever you entered the map. However, if you entered via spiral staircase, you technically entered the map 16px to the right or left of where the stairs (and your destination entity) are. So you'll respawn trapped in the wall, since the respawn script doesn't know if you came into the room via staircase.

So I'm wondering, is there any way to let the script know that you entered the map via spiral staircase?

Development / Re: Enemies that cling and slow the hero down.
« on: May 03, 2018, 07:40:01 pm »
You could also use a metaevent for on_map_changed, or on world changed, that resets the hero's stats (walking speed and abilities) to savegames variables, besides doing this whenever the game is loaded up. This could be figured out and perhaps exploited by the player, but would help safeguard against potential bugs.

I've given this a little thought because I was thinking about potential temporary-stat-boosting potions, but it does open up a lot of bugs. I can't think of a way to have like something like "this boosts your attack for 15 minutes" carry over if the game is paused and restarted, all effects would need to be reset upon quitting the game. And perhaps upon dying, too, I'm not sure if timers with the context "game" are destroyed or not when you die and are reset. Probably depends on how death is handled by your game.

Development / Re: Enemies that cling and slow the hero down.
« on: May 03, 2018, 12:34:50 am »
I think there's an event called enemy:on_attacking_hero(). You could call some code here that sets the hero's speed to something lower, then removes the attack ability of the hero. Then you could set a timer that after 5 seconds sets the hero's speed back and gives the track ability back.

There's probably a better way to do this. I also have no idea what would happen if the player saved or reset the game or died in this state, you'd need some way to reset the hero's abilities since in these cases, the timer that would give the hero's abilities back would get destroyed.

Your scripts / Re: Deku/Turret Type Enemy
« on: May 02, 2018, 06:12:26 pm »
Oh shoot, I should also have included the script of a projectile for example, too. I'll put them down here as well as in the first post.

Also llamazing, that makes things hella concise, I love it. I don't know if I'll update every enemy I've done so far, but I will likely use that format in my next game : )

Here's a projectile that goes in orthogonal directions, borrowed from Solarus DX:

Code: Lua
  1. -- Stone shot by Octorok.
  3. local enemy = ...
  5. function enemy:on_created()
  7.   enemy:set_life(1)
  8.   enemy:set_damage(2)
  9.   enemy:create_sprite("enemies/" .. enemy:get_breed())
  10.   enemy:set_size(8, 8)
  11.   enemy:set_origin(4, 4)
  12.   enemy:set_invincible()
  13.   enemy:set_obstacle_behavior("flying")
  14.   enemy:set_attack_consequence("sword", "custom")
  15. end
  17. function enemy:on_obstacle_reached()
  19.   enemy:remove()
  20. end
  22. function enemy:go(direction4)
  24.   local angle = direction4 * math.pi / 2
  25.   local movement = sol.movement.create("straight")
  26.   movement:set_speed(150)
  27.   movement:set_angle(angle)
  28.   movement:set_smooth(false)
  29.   movement:start(enemy)
  31.   enemy:get_sprite():set_direction(direction4)
  32. end
  34. --destroy if hit with sword
  35. --
  36. function enemy:on_custom_attack_received(attack, sprite)
  38.   if attack == "sword" then
  39.   enemy:remove_life(1)
  40.   end
  41. end
  42. --]]

And here's one that will go in any direction, also adapted from Solarus DX:

Code: Lua
  1. -- 3 fireballs shot by enemies like Zora and that go toward the hero.
  2. -- They can be hit with the sword, this changes their direction.
  3. local enemy = ...
  5. local sprites = {}
  7. function enemy:on_created()
  9.   enemy:set_life(1)
  10.   enemy:set_damage(2)
  11.   enemy:set_size(8, 8)
  12.   enemy:set_origin(4, 4)
  13.   enemy:set_obstacle_behavior("flying")
  14.   enemy:set_can_hurt_hero_running(true)
  15.   enemy:set_invincible()
  16.   enemy:set_attack_consequence("sword", "custom")
  18.   sprites[1] = enemy:create_sprite("enemies/" .. enemy:get_breed())
  19.   -- Sprites 2 and 3 do not belong to the enemy to avoid testing collisions with them.
  20.   sprites[2] = sol.sprite.create("enemies/" .. enemy:get_breed())
  21.   sprites[3] = sol.sprite.create("enemies/" .. enemy:get_breed())
  22. end
  24. local function go(angle)
  26.   local movement = sol.movement.create("straight")
  27.   movement:set_speed(175)
  28.   movement:set_angle(angle)
  29.   movement:set_smooth(false)
  31.   function movement:on_obstacle_reached()
  32.     enemy:remove()
  33.   end
  35.   -- Compute the coordinate offset of follower sprites.
  36.   local x = math.cos(angle) * 10
  37.   local y = -math.sin(angle) * 10
  38.   sprites[1]:set_xy(2 * x, 2 * y)
  39.   sprites[2]:set_xy(x, y)
  41.   sprites[1]:set_animation("walking")
  42.   sprites[2]:set_animation("following_1")
  43.   sprites[3]:set_animation("following_2")
  45.   movement:start(enemy)
  46. end
  48. function enemy:on_restarted()
  50.   local hero = enemy:get_map():get_hero()
  51.   local angle = enemy:get_angle(hero:get_center_position())
  52.   go(angle)
  53. end
  55. -- Destroy the fireball when the hero is touched.
  56. function enemy:on_attacking_hero(hero, enemy_sprite)
  58.   hero:start_hurt(enemy, enemy_sprite, enemy:get_damage())
  59.   enemy:remove()
  60. end
  62. -- Change the direction of the movement when hit with the sword.
  63. function enemy:on_custom_attack_received(attack, sprite)
  65.   if attack == "sword" and sprite == sprites[1] then
  66.     local hero = enemy:get_map():get_hero()
  67.     local movement = enemy:get_movement()
  68.     if movement == nil then
  69.       return
  70.     end
  72.     local old_angle = movement:get_angle()
  73.     local angle
  74.     local hero_direction = hero:get_direction()
  75.     if hero_direction == 0 or hero_direction == 2 then
  76.       angle = math.pi - old_angle
  77.     else
  78.       angle = 2 * math.pi - old_angle
  79.     end
  81.     go(angle)
  84.     -- The trailing fireballs are now on the hero: don't attack temporarily
  85.     enemy:set_can_attack(false)
  86.     sol.timer.start(enemy, 500, function()
  87.       enemy:set_can_attack(true)
  88.     end)
  89.   end
  90. end
  92. function enemy:on_pre_draw()
  94.   local map = enemy:get_map()
  95.   local x, y = enemy:get_position()
  96.   map:draw_visual(sprites[2], x, y)
  97.   map:draw_visual(sprites[3], x, y)
  98. end

Development / Re: The dangerous escape key
« on: May 02, 2018, 06:04:37 pm »
Thanks, llamazing! This works great.

Pages: [1] 2 3 ... 6