I have made a simple frogger game nothing serious just something to practice 2d and such. I have completed the entire game in a couple of hours except for one minor detail, ok so its a big detail but still. When i create a car panel with pan_create then i run a different function to move the panel its fine, but when i create another panel and try to move that one the first one stops. I know it is doing this because I am overwriting the panel pointer so my question is how to do this?
Here is what i have so far.
function move_car(new_car,lane)
{
car_speed = random(.4) + min_speed;
move_car_pan = new_car;
while(move_car_pan.visible == ON)
{
if(lane <= 3){move_car_pan.pos_x -= car_speed;}
else{move_car_pan.pos_x += car_speed;}
if(move_car_pan.pos_x < 0){move_car_pan.visible = OFF;}
if(move_car_pan.pos_x > 800){move_car_pan.visible = OFF;}
wait(1);
}
}
function create_car(lane)
{
car_pos.y = lane*50 + 50;
if(lane <= 3){car_pos.x = 800;}
else{car_pos.x = 0;}
new_car = pan_create("bmap = car; flags = visible, refresh,overlay;",3);
new_car.pos_x = car_pos.x;
new_car.pos_y = car_pos.y;
move_car(new_car,lane);
wait(1);
}
The lane variable is just which lane the car is spawned in. Any help would be appreciated, thanks.
I just changed a number.