screen scroll
March 15th 2004, 03:58 PM

D.G.Ford


How does the dink engine control the screen scrolls? Is there any way to control the screen it will scroll to? i.e. wrap around worlds
Is there any way to control it from scripts
Is there any way to control it from scripts
easily. Scripts can control that with a variable called &player_map . But learning how to script takes a while. Read the tutorials and look at some source code (uncompiled .c scripts). If you have the source code for the original game look in S7-warp.c . Its a good example of how to do that. If you have Bane of the Magi, try the scripts called wrapL.c and wrapR.c . They do what you mentioned.(Also Bane has "a-sample.c" . Its a tutorial script you can paste into a new dmod. Readable and useable.)
you dont need any dinkc whatsoever to make a warp in dink edit. i learned dink edit way before i could script, and i had warps going on. the thing i did that helped me the most was to take the dink main game, look at all the attributes to sprites, move them around, change things, etc. then i went to playing around with the original source, changing what people say, and eventually understanding the whole concept of programming, just from looking at the dink .c files.
March 19th 2004, 10:30 AM

D.G.Ford


Haven't tried Bane of Magi. Are you sure you're talking about a scroll and not just a warp. i.e. the screen moves and doesn't just fade into the next one
Is there anywhere I can find out how &player_map, sp_x, and sp_y work?
If I recall the tutorial that came with the main game said to set sp_x and sp_y to your starting map co-ord, but when you do that the screen won't scroll to adjoining screens. I learned you have to set &player_map to your starting map.
Is there anywhere I can find out how &player_map, sp_x, and sp_y work?
If I recall the tutorial that came with the main game said to set sp_x and sp_y to your starting map co-ord, but when you do that the screen won't scroll to adjoining screens. I learned you have to set &player_map to your starting map.
As Joshriot says you can do much with warp properties of sprites, but if you do want a large area to wrap then its like this:
void touch ()
{
&player_map += 5;
sp_x(1,590);
load_screen(&player_map);
draw_screen();
}
This is wrap-L.c . It moves the player 5 screens to the right and along the right edge of the screen. note, it does not have a fade_down and fade up. Its basicly the minimum needed to do this. (wrap-R.c is the same, but -=5; and sp_x=10
&player_map,&sp_x, and &sp_y are global variables created in main. Normaly the engine updates them whenever dink walks to the edge of the screen, then the engine automaticaly does the load and draw of the new screen. Since the variables are global, any script can control it.
Of course this script is attached to an invisable sprite within 10 pixels of the edge.
void touch ()
{
&player_map += 5;
sp_x(1,590);
load_screen(&player_map);
draw_screen();
}
This is wrap-L.c . It moves the player 5 screens to the right and along the right edge of the screen. note, it does not have a fade_down and fade up. Its basicly the minimum needed to do this. (wrap-R.c is the same, but -=5; and sp_x=10

&player_map,&sp_x, and &sp_y are global variables created in main. Normaly the engine updates them whenever dink walks to the edge of the screen, then the engine automaticaly does the load and draw of the new screen. Since the variables are global, any script can control it.
Of course this script is attached to an invisable sprite within 10 pixels of the edge.
If I understand what you're saying, no. Though right and left (east and west) edges of the map wrap, like lines on a page, the screens on the right and connected to the screens on the left one row down. If you want something else, you'll probably have to fake it with warps.