igorfs10 / rust_hero

Um jogo simples em rust
GNU General Public License v3.0
4 stars 1 forks source link

Added Desert and Cave backgrounds #6

Closed 1sra3l closed 3 years ago

1sra3l commented 3 years ago

I added two backgrounds to get started seeing what the game might look like

1sra3l commented 3 years ago

@igorfs10 I am implementing movement between locations, via the ui.forward and ui.backward and emitting a signal. Should "forward" simply cycle through the Locations, or should there be some sort of long sequence we iterate over? Something similar to a map that starts in a town and is linear, like:

let map = [Town, 
           Forest, Forest, Forest, Forest, Forest, Forest, 
           Town, 
           Cave, Cave, Cave, Cave, Cave, Cave,
           Town,
           Desert,  Desert,  Desert,  Desert,
           Town,
           Forest, Swamp, Swamp, Forest];
           // etc...

let mut place = 0;
if forward {
 place += 1 ;
} else if backward {
  place -= 1;
}

// check range, etc..

let location : Location = Location::get_location(&map[place]);
1sra3l commented 3 years ago

Please let me know if the images fail to load when you run it, since you are on Windows. I use fs::canonicalize so I hope it reads everything correctly, since I use Unix paths for the locations::Location.image

igorfs10 commented 3 years ago

Worked great on windows, I just need to let compiler copies assets file to target folder. I liked the emit function, I guessed I had to use set_callback for everything. Nice work 👍

1sra3l commented 3 years ago

@igorfs10 Thanks! I may still tweak the artwork, but I was excited to get a bit of a working "game" going. Have you thought about what library to use for music? I put some ogg files in a folder, listen to the file on loop to see what you think. I made all of them very short loops (7-8 seconds).

My next commit will update the readme and add screenshots. I'll wait a bit on it, so you can play around with the code and change whatever you want to!