Answered by:
Geometric Formula NEEDED! (Shadowing)
Question

is there a formula or a way to get a line trough a predefined corner of an object, so you can connect all the endpoints to get a shadow?
like this here:
and then create the shadow with those points:
and here a perfect version of how the shadow should look like:
Live for nothing, OR CODE FOR SOMETHING! Edited by Dudeson Sunday, August 30, 2009 10:46 AM
Answers

Shadows is ray tracing.
i.e following vectors from a light source to objects. If the geometry is very simple, then the ray tracing can be simplified like Fremy's equivalent triangles, but then when you extend it you need to revert to the underlying principles of ray tracing.
No answers that are simple and general. Either general (ray tracing and vectors) or simple (equivalent triangles for example).
Ray tracing is the true solution. Here's the principe of ray tracing applied to a polygon. Dudeson, if you want to work with other kind of surfaces like circles or ellipses, you'll need to consider them as polygons with many faces (let's say, a polygon with 30 faces). You can then apply the same idea as in the document here : http://cid201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/Shadows.pdf
If you want true ray tracing, you'll need to draw a lot of lines. The prinicipe is very simple. It's like this image.
http://cid201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/raytracing.jpg
Fremy  Developer in VB.NET, C# and JScript ...  Feel free to try my extension Proposed as answer by litdevModerator Tuesday, September 1, 2009 9:41 PM
 Marked as answer by litdevModerator Tuesday, September 15, 2009 8:43 PM
All replies

See my previous post on how to calculate the equation of a line passing through 2 points. There are no magic answers, just relatively simple 2D geometry.
To post an image it must first be uploaded somewhere on the web, say MS skydrive or your website. Then use the HTML editor option of the post edit to do the following.
http://social.msdn.microsoft.com/Forums/enUS/smallbasic/thread/c658843cfd47477e93b001dcffcd6af4 
These kind of models use 'ray tracing' i.e. following the path of light with vectors, reflecting, adsorbing and transmitting according to objects and their properties in their path.
While you can do this in SmallBasic for simple cases, in general it will be too slow and not the best environment for all but the simplest cases. It is however a good place to 'get to grips' with the geometry and maths as a learning exercise. But for a SmallBasic game I would avoid these complexities and concentrate on good gameplay, using good images and sounds and smooth play.
Other alternatives for games development using such as DirectX or GDI, or software libraries for graphics (Dark, VTK etc) have big learning curves. I suggest you continue with your SmallBasic zombie project, but as a side line also look at one of the MS Express2008 languages, VB, C# or C++. These are all similar as a starting point (big and confusing), but there is plenty of support and books available (much more than Small Basic for example). Perhaps check out the support forums (MS and others) and books before choosing. With your enthusiasm and interest to experiment I am sure you will make good progress.
Scratch>SmallBasic>MS Express>?. 

Shadows is ray tracing.
i.e following vectors from a light source to objects. If the geometry is very simple, then the ray tracing can be simplified like Fremy's equivalent triangles, but then when you extend it you need to revert to the underlying principles of ray tracing.
No answers that are simple and general. Either general (ray tracing and vectors) or simple (equivalent triangles for example). 
Shadows is ray tracing.
i.e following vectors from a light source to objects. If the geometry is very simple, then the ray tracing can be simplified like Fremy's equivalent triangles, but then when you extend it you need to revert to the underlying principles of ray tracing.
No answers that are simple and general. Either general (ray tracing and vectors) or simple (equivalent triangles for example).
Ray tracing is the true solution. Here's the principe of ray tracing applied to a polygon. Dudeson, if you want to work with other kind of surfaces like circles or ellipses, you'll need to consider them as polygons with many faces (let's say, a polygon with 30 faces). You can then apply the same idea as in the document here : http://cid201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/Shadows.pdf
If you want true ray tracing, you'll need to draw a lot of lines. The prinicipe is very simple. It's like this image.
http://cid201f3835d49587fe.skydrive.live.com/self.aspx/Public/Small%20Basic/raytracing.jpg
Fremy  Developer in VB.NET, C# and JScript ...  Feel free to try my extension Proposed as answer by litdevModerator Tuesday, September 1, 2009 9:41 PM
 Marked as answer by litdevModerator Tuesday, September 15, 2009 8:43 PM

Here a true Ray Tracing program made in Small Basic. Please note it's NOT optimised. I should have been used Controls.GetAllShapes and the walked only zone where it's possible to have a shadow, but my code run relatively fast (5/10 seconds to generate all shadows on my computer) and is only here to show what's the Ray Tracing method.
Check here : GKQ375
BTW, please note you'll need the latest version of my extension (v2.2) to have this sample to work.
Fremy  Developer in VB.NET, C# and JScript ...  Feel free to try my extension 
Here a true Ray Tracing program made in Small Basic. Please note it's NOT optimised. I should have been used Controls.GetAllShapes and the walked only zone where it's possible to have a shadow, but my code run relatively fast (5/10 seconds to generate all shadows on my computer) and is only here to show what's the Ray Tracing method.
sry, but i dont have your extenstion...
Check here : GKQ375
BTW, please note you'll need the latest version of my extension (v2.2) to have this sample to work.
Fremy  Developer in VB.NET, C# and JScript ...  Feel free to try my extension
Live for nothing, OR CODE FOR SOMETHING!