walle / raycaster

A quick port of "A first-person engine in 265 lines" from JavaScript to Java using the libGDX framework.
MIT License
72 stars 14 forks source link

Adding enemies #2

Closed Rombusevil closed 8 years ago

Rombusevil commented 8 years ago

Hey bro! This works great! I'm trying to get a flat sprite rendering going on, like for enemies or objects rather than walls but I'm having a hard time doing that, my math is really bad. Would you consider adding flat sprite rendering? or maybe any advice on how to do that?

I'm adding tiled map support and multi-textured walls to this library in hopes of making it a full featured raycasting engine.

Hope I hear from you! :D

walle commented 8 years ago

Hello!

I don't think I will add anything to this project, it is a fork of the project described at http://www.playfuljs.com/a-first-person-engine-in-265-lines/ But I think I could give you some advise at least :)

You can check out some of the forks e.g. Mustachio'd enemies by Nic Mendoza - http://nicmendoza.github.io/playfuljs-demos/raycaster/ source https://github.com/nicmendoza/playfuljs-demos/tree/gh-pages/raycaster it's in JavaScript though, like the original. You can see some other changes here https://github.com/hunterloftis/playfuljs-demos/network includes multi textured walls and enemies. This fork https://github.com/tiriana/playfuljs-demos demo - http://tiriana.github.io/playfuljs-demos/raycaster/ includes enemies. You can view the diff from the original here https://github.com/hunterloftis/playfuljs-demos/compare/gh-pages...tiriana:gh-pages

It was a long time since I touched this code, but if I remember correctly adding enemies should not be that hard. It's basically the same as rendering a wall, just rotated so it always faces the player/camera. I think the term is billboarded sprites.

I think this resource is frequently referred to when talking about raycasters. http://lodev.org/cgtutor/raycasting.html

Best of luck with your project!

Rombusevil commented 8 years ago

Thanks Fredrik! I'll take a look at those repos, looking awesome at first glance. I searched in the forks of this project but didn't occur to me to go search the forks of the source :P

Cheers!