Are you certain that drawing happening on DMap 6, and that the source screen for the effect from Map 15 is Screen 13, and not 0x13?
You should run a trace of some kind in there, to see if your if block is executing.
void AbyssBackground(){
int xspeed = 1;
int yspeed = 1;
int LayerMovement = Game->GetCurDMap();
int s_running[]="LayerMovement block is running.";
if (LayerMovement == 6){
TraceNL(); TraceS(s_running); TraceNL(); //Will print 'LayerMovement block is running to allegro.log if it runs.
x_position = (x_position + xspeed) % 255;
y_position = (y_position + yspeed) % 175;
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position), Floor(y_position), 0, OP_OPAQUE);
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position), Floor(y_position) - 128, 0, OP_OPAQUE);
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position) - 176, Floor(y_position), 0, OP_OPAQUE);
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position) - 176, Floor(y_position) - 128, 0, OP_OPAQUE);
}
}
You may be better off with this:
//Accept the desired DMap as an argument.
void AbyssBackground(int dmap){
int xspeed = 1;
int yspeed = 1;
int s_running[]="Abyss BG *if* block is running.";
if (Game->GetCurDMap() == dmap){
TraceNL(); TraceS(s_running); TraceNL(); //Will print: 'Abyss BG *if* block is running.' to allegro.log if it runs.
x_position = (x_position + xspeed) % 255;
y_position = (y_position + yspeed) % 175;
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position), Floor(y_position), 0, OP_OPAQUE);
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position), Floor(y_position) - 128, 0, OP_OPAQUE);
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position) - 176, Floor(y_position), 0, OP_OPAQUE);
Screen->DrawLayer(2, 15, 13, 0, Floor(x_position) - 176, Floor(y_position) - 128, 0, OP_OPAQUE);
}
}
If the if block is running, you may be targeting the incorrect screen. You entered it as an arg to DrawLayer() in decimal format, so becertain that the screen is 13, and not 0x13.
Here's how to do this without making a new function for it, every time you want to put a scrolling background on another DMap:
//Accepts args for validation DMap; then source screen, map, and layer.
void MovingBackground(int dmap, int layer, int src_map, int src_screen, int src_layer){
int xspeed = 1;
int yspeed = 1;
int s_running[]="BG *if* block is running.";
if (Game->GetCurDMap() == dmap){
TraceNL(); TraceS(s_running); TraceNL(); //Will print: 'BG *if* block is running.' to allegro.log if it runs.
x_position = (x_position + xspeed) % 255;
y_position = (y_position + yspeed) % 175;
Screen->DrawLayer(layer, src_dmap, src_screen, src_layer, Floor(x_position), Floor(y_position), 0, OP_OPAQUE);
Screen->DrawLayer(layer, src_dmap, src_screen, src_layer, Floor(x_position), Floor(y_position) - 128, 0, OP_OPAQUE);
Screen->DrawLayer(layer, src_dmap, src_screen, src_layer, Floor(x_position) - 176, Floor(y_position), 0, OP_OPAQUE);
Screen->DrawLayer(layer, src_dmap, src_screen, src_layer, Floor(x_position) - 176, Floor(y_position) - 128, 0, OP_OPAQUE);
}
}
You would call this as:
MovingBackground(6,2,15,13,0);
If you do that, setting up constants for the numeric args, would be wise, e..g.:
const int SCROLL_ABYSS_DMAP = 6;
const int SCROLL_ABYSS_LAYER = 2;
const int SCROLL_ABYSS_SRC_SCREEN = 15;
const int SCROLL_ABYSS_SRC_MAP = 13;
const int SCROLL_ABYSS_SRC_LAYER = 0;
Them use those constants in the function call, instead of fixed values:
MovingBackground(SCROLL_ABYSS_DMAP, SCROLL_ABYSS_LAYER, SCROLL_ABYSS_SRC_SCREEN, SCROLL_ABYSS_SRC_MAP, SCROLL_ABYSS_SRC_LAYER);
That makes it both easier to debug in the long-term, and easier to re-use.
Edited by ZoriaRPG, 04 September 2015 - 04:02 AM.