Recent posts
#61
Development / Re: Need Help With Having an N...
Last post by PhoenixII54 - May 09, 2023, 11:40:17 AMI don't see any obvious mistake (maybe i would have organized the list in the style 1 entry = an {x=x,y=y} pair but that's just a coding preference) so my guess is that your movement gets overwritten each frame you move and doesn't have time to even start until you stop moving.
So what you should try to do is to detect if the follower NPC already has a movement and update it's target (if possible) instead of recreating a new one each frame, and only create it again if it it reached its actual destination when the hero has stopped moving.
So what you should try to do is to detect if the follower NPC already has a movement and update it's target (if possible) instead of recreating a new one each frame, and only create it again if it it reached its actual destination when the hero has stopped moving.
#62
Development / Re: Need Help With Having an N...
Last post by lefthandedhero - May 08, 2023, 07:09:26 PMUsing the advice above, I created the following code. Note that "Follower" is the name of the NPC:
The current code has two main problems:
1. Follower does not start moving until the moment the hero stops moving, when the idea was that the follower would move while the hero moves and stop when the hero stops.
2. Follower does not stop moving, as if the current target is the hero's current position when it should be the hero's previous position.
Where have I gone wrong in my implementation that is causing these problems?
Code Select
-- Table to store the hero's old postion (List[0] = x, List[1] = y, List[2] = layer):
List = {}
-- Follower Movement:
function hero:on_position_changed(x, y, layer)
-- If not the hero's first movement:
if List[0] ~= nil then
-- Move Follower to the old coordinates
local movement = sol.movement.create("target")
-- Set the previous position as the target
movement:set_target(List[0], List[1])
-- Make the movement speed match the hero
movement:set_speed(88)
-- Move
movement:start(Follower)
end
-- Record the hero's new position
List[0] = x
List[1] = y
end
The current code has two main problems:
1. Follower does not start moving until the moment the hero stops moving, when the idea was that the follower would move while the hero moves and stop when the hero stops.
2. Follower does not stop moving, as if the current target is the hero's current position when it should be the hero's previous position.
Where have I gone wrong in my implementation that is causing these problems?
#63
Development / Re: Need Help With Having an N...
Last post by lefthandedhero - May 05, 2023, 04:09:45 PMQuote from: PhoenixII54 on May 05, 2023, 11:30:22 AM
Hello, you can use the hero:on_position_changed() event, which is called each frame Link has moved.Code Select
-- <initialization stuff where you get the hero and NPC entities>
function hero:on_position_changed(x, y, layer)
--update your list here and move the NPC accordingly
end
Thank you very much. This is a big help.
Quote from: Christopho on May 05, 2023, 03:20:57 PM
An alternative way is to make a target movement towards the hero, and stop that movement when the distance between the NPC and the hero gets below some threshold. I think it is done that way in the Zelda A Link to the Dream project.
Your choice, I guess it depends on whether you want the NPC to follow exactly the same path as the hero or not.
Thank you. I do want the NPC to follow the same path as the hero; it's important for another component of the game that I'm trying to make that the NPC follow the same path. But I may fall back on that method if I can't get my current plan to work.
#64
Development / Re: Need Help With Having an N...
Last post by Christopho - May 05, 2023, 03:20:57 PMAn alternative way is to make a target movement towards the hero, and stop that movement when the distance between the NPC and the hero gets below some threshold. I think it is done that way in the Zelda A Link to the Dream project.
Your choice, I guess it depends on whether you want the NPC to follow exactly the same path as the hero or not.
Your choice, I guess it depends on whether you want the NPC to follow exactly the same path as the hero or not.
#65
Development / Re: Need Help With Having an N...
Last post by PhoenixII54 - May 05, 2023, 11:30:22 AMHello, you can use the hero:on_position_changed() event, which is called each frame Link has moved.
Code Select
-- <initialization stuff where you get the hero and NPC entities>
function hero:on_position_changed(x, y, layer)
--update your list here and move the NPC accordingly
end
#66
General discussion / Re: What's Your Favorite Zelda...
Last post by lefthandedhero - May 03, 2023, 08:44:10 PM1. Spirit Tracks. I recognize that there are better Zelda games, and I myself have some grievances with it; namely that the spirit flute has to be by far the worst Zelda instrument. But the things work about this game are done amazingly well and easily more than make up for its faults. I really like the train, and I love Spirit Zelda: having Princess Zelda be Link's adventuring companion in this game was nothing short of brilliant, to the point where I almost wonder why it wasn't done sooner and I do wonder why it hasn't been done since. Controlling Link and Zelda together is a ton of fun.
2. Ocarina of Time. It introduced me to the Zelda series, so of course it's going to be in the top 3, and it helps that it's still one of the best Zelda games overall.
Nominations for 3rd place: Link's Awakening, Majora's Mask, Wind Waker and Breath of the Wild.
Winner of the position of 3rd place: Wind Waker. There isn't really much to say; like Sprit Tracks, the game has a ton of charm, the sailing is fun, and I really like the deep narrative under the surface and the theme of the winds of change and the idea that Hyrule waiting for a hero to appear was exactly what doomed Hyrule.
2. Ocarina of Time. It introduced me to the Zelda series, so of course it's going to be in the top 3, and it helps that it's still one of the best Zelda games overall.
Nominations for 3rd place: Link's Awakening, Majora's Mask, Wind Waker and Breath of the Wild.
Winner of the position of 3rd place: Wind Waker. There isn't really much to say; like Sprit Tracks, the game has a ton of charm, the sailing is fun, and I really like the deep narrative under the surface and the theme of the winds of change and the idea that Hyrule waiting for a hero to appear was exactly what doomed Hyrule.
#67
Development / Need Help With Having an NPC F...
Last post by lefthandedhero - May 02, 2023, 07:36:06 PMHello.
I am new to using the Solarus engine. I want to create an NPC that follows the hero as a companion by closely following behind the hero and following the same path as the hero; the type of movement that's used in A Link to the Past when Link escorts Zelda out of Hyrule Castle and when Marin accompanies Link for part of Link's Awakening, and is at as old as the classic snake game genre.
Any suggestions for implementing this in Solarus?
UPDATE 1: After watching some videos of the section of A Link to the Past where Link escorts Zelda out of Hryule Castle for reference, I observed some details of Zelda's movement that may help: upon entering any new area or exiting a set of stairs, Zelda always starts one in-game step behind Link, stays still after Link's first in-game step, then starts moving after Link's second in-game step, with Zelda's steps being the step Link took two steps previously. When Link stops moving, Zelda immediately stops moving at the same time, and when Link resumes moving, Zelda immediately resumes moving.
After observing this, the plan I have created is to essentially store the hero's movements in a linked list of maximum length 1: upon entering a new map section, the linked list will be empty. When the hero moves, their "step" is pushed into the list, and once the list is full, the non-playing character does each step that is "popped" out of the linked list. When the hero stops moving, the non-playing character stops moving.
I know how to create a linked list in Lua, so there are two things I still need:
1. The ideal method of storing each in-game step in the linked list.
2. How to implement, "while (the hero is moving) {}".
Any suggestions for solving those two things?
I am new to using the Solarus engine. I want to create an NPC that follows the hero as a companion by closely following behind the hero and following the same path as the hero; the type of movement that's used in A Link to the Past when Link escorts Zelda out of Hyrule Castle and when Marin accompanies Link for part of Link's Awakening, and is at as old as the classic snake game genre.
Any suggestions for implementing this in Solarus?
UPDATE 1: After watching some videos of the section of A Link to the Past where Link escorts Zelda out of Hryule Castle for reference, I observed some details of Zelda's movement that may help: upon entering any new area or exiting a set of stairs, Zelda always starts one in-game step behind Link, stays still after Link's first in-game step, then starts moving after Link's second in-game step, with Zelda's steps being the step Link took two steps previously. When Link stops moving, Zelda immediately stops moving at the same time, and when Link resumes moving, Zelda immediately resumes moving.
After observing this, the plan I have created is to essentially store the hero's movements in a linked list of maximum length 1: upon entering a new map section, the linked list will be empty. When the hero moves, their "step" is pushed into the list, and once the list is full, the non-playing character does each step that is "popped" out of the linked list. When the hero stops moving, the non-playing character stops moving.
I know how to create a linked list in Lua, so there are two things I still need:
1. The ideal method of storing each in-game step in the linked list.
2. How to implement, "while (the hero is moving) {}".
Any suggestions for solving those two things?
#68
General discussion / What's Your Favorite Zelda Gam...
Last post by PoPCaT6800 - April 29, 2023, 04:46:42 PMWhat's Your Top 3 Favorite Zelda Games? tell me in the comments!
My Favorites
3: The Legend Of Zelda: A Link Between Worlds
When I got this game on my 3DS, I was amazed by how it managed to remind you so much of ALTTP while making it's own game. I loved the music remixes and everything was so fluid.
2: The Legend Of Zelda: A Link To The Past
When I was younger, I hated old pixel style games. They freaked me out for some reason. Eventually my Dad made me play the original Zelda 1. I didn't really like it, but eventually I tried ALTTP. Something clicked, and in the blink of an eye I had spent at least 75 hours playing (I still haven't finished).
3: The Legend Of Zelda: Twilight Princess
This was my very first Zelda game. I was digging around in the wii games for something to play and I came across TP. I wasn't sure if it was going to be any good or not. I loved it. I spent so much time trying to figure out the Zora temple and beat Ganon that I probaly spent a good year of my life on it.
What's your top 3?
My Favorites
3: The Legend Of Zelda: A Link Between Worlds
When I got this game on my 3DS, I was amazed by how it managed to remind you so much of ALTTP while making it's own game. I loved the music remixes and everything was so fluid.
2: The Legend Of Zelda: A Link To The Past
When I was younger, I hated old pixel style games. They freaked me out for some reason. Eventually my Dad made me play the original Zelda 1. I didn't really like it, but eventually I tried ALTTP. Something clicked, and in the blink of an eye I had spent at least 75 hours playing (I still haven't finished).
3: The Legend Of Zelda: Twilight Princess
This was my very first Zelda game. I was digging around in the wii games for something to play and I came across TP. I wasn't sure if it was going to be any good or not. I loved it. I spent so much time trying to figure out the Zora temple and beat Ganon that I probaly spent a good year of my life on it.
What's your top 3?
#69
Development / Re: Solarus Quest Resolution S...
Last post by ZeldaGamer - April 28, 2023, 02:37:23 AMFound a solution, for anyone interested:
File => Quest Properties ... and changing the resolution right in the menu
Editing the quest.dat file in the main directory also works
File => Quest Properties ... and changing the resolution right in the menu
Editing the quest.dat file in the main directory also works
#70
Development / Solarus Quest Resolution Size
Last post by ZeldaGamer - April 27, 2023, 02:50:13 AMHello everyone,
I am brand new to Solarus and have been googling a question, however it only had old replys from back in 2013.
I was trying to change the quest resolution size in the tools => options menu in Solarus. However, changing the resolution seemly has no effect. No matter what the resolution is set to, the quest launches at one resolution. Has this feature been implemented yet?
Thanks
I am brand new to Solarus and have been googling a question, however it only had old replys from back in 2013.
I was trying to change the quest resolution size in the tools => options menu in Solarus. However, changing the resolution seemly has no effect. No matter what the resolution is set to, the quest launches at one resolution. Has this feature been implemented yet?
Thanks