No objections at all, no credit for
me needed just credit "xTalk Community," make us look
HUGE.
These examples are long overdue, I wish I could have wrapped my head around them ages ago.
Use the text in forum posts for 'documentation' where applicable.
As for that "Puzzle-Platformer" demo , sure we can do that, probably pretty easy.
Thanks for the suggestion, actually.
There is an example of gravity and the 'push' behavior in this platformer demo in fact.
Let's see if I can psuedo code it...
if Player collision occurs with 'boulder', then the player's x or y direction value (-1, or 1) is transferred to the object, creating the illusion of a push.
All objects that can move receive an update every game loop, even if their move values are 0, once that value changes they will move.
Each loop of the game all movable objects will have their collision checked, this is done by checking the topLeft, topRight, bottomLeft and bottomRight being within the rect of another graphic.
Intersect might be more applicable with sprites that have feet and pushing hand pixels? Haven't tried that yet.
If the falling type object is not colliding with some object then it's Y direction value is set to 1, so each loop it will 'fall' one pixel, just like the player moves in whatever direction their value is not 0.
To do the delayed drop thing, you have some value in the object like AvalancheDelay, after the first lack of collision at the bottom of the object is detected, or a collision with the player at the bottom of the 'boulder' is detected, that starts to count up (or down) one measure each game loop, when it hits whatever limit is desired then the Y value is set to one and it will fall 1 pixel each loop until it hits something. Might also have a bDangerous or bAvalanche value in the object to set it as deadly instead of just something he can push around with his head, or something that kills him the first time he runs under it.
Animating the boulder getting loose, if you had some sprites for that then those could be the trigger that makes it fall, ie, when it's done displaying it's "get loose" frames, then plummet. In a graphics only example we could use points like in the circle demonstration to animate some changes to the 'boulder' or even just tweak it's rotation a little bit to give it the shake before fall effect.
I'll work something up, using only built in graphics to keep things simple and
Major Havoc'y.
I feel we need some kind of asset manager for sprites, because you import a bunch of stuff then make it all vanish off screen until you need it, which produces a mystery of "How'd that get there?" for the next person that comes along, at least with vector graphics it's all right there in the code.
I'd like to write a file parser for some of the popular tilemap editors so i don't have to write the tilemap editor myself, yet.