Added a lot of Javascript and figured out how to do Axis Aligned Bounding Box Collisions in Hype to let the player move around. Hype does a wonderful job with audio. (Note: This is based off a video game from 1981, so the graphics are suppose to be primitive and “blocky”.)
If you find any bugs or quirks, please let me know what browser platform you are using. Thanks so much for any feedback.
Hi Darren,
cool, thanks for sharing.
I’m using Chrome, and in the second screen, I can move the arrow or the key of the limits of the game screen, inside the gate on the top of the screen. Maybe, if there are no more screen, you should use a static wall, for this not to happens.
It’s part of collision detection. Took a lot of trial and error to make it work. Used a lot of global variables. For the key, I created a global variable called window.GOLDKEYATTACHED and set it initially equal to “no”. Depending on which side the player bumps into it, it takes on the value of “top”, “right”, “bottom” or “left”. I use this to determine the key position based off of the player position. When you press spacebar, the value goes to “no” and you drop the key.
For collision detection in general, I created a 2D array which is a grid of the scene. If a grid contains the value 0, you can move into it. I used 1 to represent a wall, 2 for the gold key, 3 for the black key, etc.
Now this would be a great canned function for Hype in the future if that is possible.
The collision detection is a jewel in the holy grail to take Hype into Game engine status
I plan to eventually. Right now need to finish up another project before I clean up the code for adventure. Also, have to balance the demands of my day job.
It's great! Master, we could use your template and adapt it to our project for children with disabilities, since it is an extraordinary exercise for children with cerebral palsy that we serve.
Thank you, master.