Hi everyone,
I posted a small sprite demo on GitHub maybe useful for those who are beginners like me with CGE. Sprite walks in eight directions with eight idle.
Taken from the readme:
Demo is divided into two parts:
Goniometer
Road demo
The first shows with extreme precision the direction of the sprite in degrees. Using mouse click coordinates and Player position I apply the arctangent formula and I convert the value obtained in degrees. This way I get the requested direction.
The second one is a demo with a road background where you can move the sprite that is sized according to the distance from the observation point. One click to walk, double click to run. Run animation is divided into three actions, short initial walk, run, short final walk but it is not perfect.
I encourage those who want and have time to modify and improve the code so as to offer newcomers some ideas to work on. I do not know about you but personally I learn a lot more from the examples than from the manuals :)
[offtopic] Today, we officialy move to a new forum on https://forum.castle-engine.io/ . It's more functional and beautiful! :)
This forum (with all the topics) will stay available for a while (to allow people to search old topics -- we cannot import them). But please post all new topics on a new forum :) If you want to post replies to the existing topic on this forum, use whatever you prefer --- you can create a new topic on a new forum, or you can post in this forum (henceforth called "old forum").
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi everyone,
I posted a small sprite demo on GitHub maybe useful for those who are beginners like me with CGE. Sprite walks in eight directions with eight idle.
Taken from the readme:
Demo is divided into two parts:
The first shows with extreme precision the direction of the sprite in degrees. Using mouse click coordinates and Player position I apply the arctangent formula and I convert the value obtained in degrees. This way I get the requested direction.
The second one is a demo with a road background where you can move the sprite that is sized according to the distance from the observation point. One click to walk, double click to run. Run animation is divided into three actions, short initial walk, run, short final walk but it is not perfect.
I encourage those who want and have time to modify and improve the code so as to offer newcomers some ideas to work on. I do not know about you but personally I learn a lot more from the examples than from the manuals :)
https://github.com/valterb/sprite-demo-castle-engine
Last edit: Valter Buccina 2019-01-10
Way cool! Thanks for creating this.
I'll announce it on CGE news soon.
I submitted a small pull request to allow running it under Linux too, https://github.com/valterb/sprite-demo-castle-engine/pull/1 :)
[offtopic] Today, we officialy move to a new forum on https://forum.castle-engine.io/ . It's more functional and beautiful! :)
This forum (with all the topics) will stay available for a while (to allow people to search old topics -- we cannot import them). But please post all new topics on a new forum :) If you want to post replies to the existing topic on this forum, use whatever you prefer --- you can create a new topic on a new forum, or you can post in this forum (henceforth called "old forum").