Skip to main content


Topic: Programming a map animation (Read 4370 times) previous topic - next topic

Re: Programming a map animation
Reply #15
 Radnen's idea of a tilling/write mode bound to the Enter key and the position of my tractor sprite was too complex for me.  I made a video using the tile changing method but the code is very linear. Now I have backed up to square one. I want to use SetUpdateScript("UpdateLines()"); and SetRenderScript("RenderLines()"); . I can get a line of any colour on a blank screen with no map by creating color variables and using the line command. I can get a line that appears over a map by putting the line command after RenderMap. Other locations in the code don't seem to have any effect.  That line seems to be on a top layer or unconnected to the map since it obscures a layer that should be above it eventually. I'm not going to worry about that for now as it adds too much complexity. I noticed that UpdateMap can be commented out with no effect when I run the code again, unless I run code that draws a line and no map by commenting out RenderMap(). Then I need UpdateMap uncommented to get the map and line to display together again. If I use Getkey in the code to stall display, the lines disappear as soon as I hit a key. Now I'm just trying to get a simple RenderLine function for a line segment an and UpdateLine function working. I'm getting UpdateLine is not defined and having trouble figuring out how to update a line endpoint in the UpdateLine function.  The code has to do some kind of count of the number of times the updateline function is called because each frame, the x- coordinate value in the UpdateLine function must be increased by one or maybe a few more. 

Re: Programming a map animation
Reply #16
If im right in what you want he finished product to look like, it sounds like ou would need some kind of array storing nodes (co-ords). Use MapToScreen() to connect the nodes with lines.

To avoid literally every node connecting (to allow for mutliple instances) you would need multiple arrays or some kind of check to run

P.S I am finding it very hard to read your posts, make sure to break it up with paragraphs and post example code

**EXTRA** dont forget to check out the API within sphere. It looked confusing to me at first, but if you do a couple of basic projects just to see how different functions work you will pick up a lot very quickly.

Link for Arrays -

***EDIT*** looking at you code behnd the picture, you are setting the X,Y for the lines, therefore they will ALWAYS appear there, they are done via screen co-ords so will not support scrolling the map and they dissapear as the code is run up to GETKEY() and no further. When you hit the key it drops the above code, you need update and render functions and some kind of variable storage
  • Last Edit: October 22, 2013, 04:32:59 pm by Harry Bo21