What is the matter with me?
Code:
script, tile x by pixel pos, px, py, begin
variable(x, y, odd)
y := tile y by pixel pos(px, py)
odd := (y ,mod, 2) == 1
if(odd) then( px -= tilesize / 2)
x := px / tilesize -- (py -- tilesize / 8) / 2 / (tilesize * 3 / 4)
exit returning(x)
end
script, tile y by pixel pos, px, py, begin
exit returning((py -- tilesize / 8) / (tilesize * 3 / 4))
end
variable(x, y, odd)
y := tile y by pixel pos(px, py)
odd := (y ,mod, 2) == 1
if(odd) then( px -= tilesize / 2)
x := px / tilesize -- (py -- tilesize / 8) / 2 / (tilesize * 3 / 4)
exit returning(x)
end
script, tile y by pixel pos, px, py, begin
exit returning((py -- tilesize / 8) / (tilesize * 3 / 4))
end
Pheonix wrote:
Non-rectangular tiles (that are also larger than 20x20) as well as pathfinding? What's going on here?
The hexagonal maptiles are actually hero sprite slices
The pathfinding is A-star pathfinding implemented in plotscripting, and using fake arrays made out of invisible slices
Quote:
The pathfinding is A-star pathfinding implemented in plotscripting, and using fake arrays made out of invisible slices
Is the code you displayed part of the A-star pathfinding, or is it just part of identifying the tile as a valid move location? If it is, can you break down the parts? To me, it looks more like it's trying to validate the tile as a legit move location, but if I'm missing the pathfinding elements in that script, I want to be able to identify them.
Place Obligatory Signature Here
Bob the Hamster wrote:
Cursed Potion Of Resist Ice (cpori)
This makes much more sense now!
There are two natural orientations for a hex grid. There are heaps of great references for hex grids, A*, and a whole lot else on Amit's game programming page.
The guide that helped me the most with hexagonal grids was this one: http://www.redblobgames.com/grids/hexagons/
The one that helped me the most with A-star was this one: http://www.policyalmanac.org/games/aStarTutorial.htm It talks about 8-direction pathfinding on a regular square grid, but the concept was easy to apply to hexagonal grid once I understood it.
The one that helped me the most with A-star was this one: http://www.policyalmanac.org/games/aStarTutorial.htm It talks about 8-direction pathfinding on a regular square grid, but the concept was easy to apply to hexagonal grid once I understood it.
Here's a video of my latest stuff:
https://www.youtube.com/watch?v=HZllWGeM2DY
And some things to come (maybe)...
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
https://www.youtube.com/watch?v=HZllWGeM2DY
And some things to come (maybe)...
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
Nathan Karr wrote:
Third graphic there makes me think of Blaster Master
Really? I'm not seeing it but will take that as a compliment nonetheless haha.
⊕ P E R S O N A L M U S I C: https://open.spotify.com/album/6fEo3fCm5C3XhtFRflfANr
⍠ C O L L A B M U S I C: https://dustpuppets.bandcamp.com/releases
sheamkennedy wrote:
Really? I'm not seeing it but will take that as a compliment nonetheless haha.
Nathan Karr wrote:
Third graphic there makes me think of Blaster Master
Really? I'm not seeing it but will take that as a compliment nonetheless haha.
Fairly large sprite of a guy with a gun and a big head who walks in four directions so yeah, totally.
Remeber: God made you special and he loves you very much. Bye!



