Is there a way to make a object visible at a random place?
Once again I have trouble with NoBlock I think, the room is like this: player is in a cellar. There are rats running around. If the player kicks a rat and the rat close enough the rat dies.
So I have the rat (the first of them) as a character and I want a object to appear where the rat is as it dies. If that’s not possible or too hard for a novice like me I guess I just give the player the rat in the inventory but I thought I ask here first.
Here is my code:
Code: ags
Code: ags
Once again I have trouble with NoBlock I think, the room is like this: player is in a cellar. There are rats running around. If the player kicks a rat and the rat close enough the rat dies.
So I have the rat (the first of them) as a character and I want a object to appear where the rat is as it dies. If that’s not possible or too hard for a novice like me I guess I just give the player the rat in the inventory but I thought I ask here first.
Here is my code:
// main global script file
function cRat_1_Mode8()
{
if ((cRat_1.x - cRose.x < 200) && (cRat_1.x - cRose.x > -200) && (cRat_1.y - cRose.y < 120) && (cRat_1.y - cRose.y > -120)) {
cRose.Say("hit");
//object[1].Move(cRat_1.x, cRat_1.y, 5, eNoBlock, eWalkableAreas);
//cRat_1.Transparency=100;
//object[1].Visible=true;
Ratisdead=true;
}
else{
cRose.Say("Miss");
}
}
// room script file
int beeninroom;
bool closeenoughtofight;
bool deadrathere;
function room_Load()
{
gHealth.Visible=true;
deadrathere=false;
}
function room_RepExec()
{
if(deadrathere==false)
{
if (character[2].Moving!=1)
{
character[2].Walk(Random(320),Random(200));
oDeadrat.Move(cRat_1.x, cRat_1.y, 50, eNoBlock, eWalkableAreas);
}
}
if ((cRose.IsCollidingWithChar(cRat_1) == 1)&&(deadrathere==false))
{
cRose.Say("Oach!");
health-=1;
}
if (Ratisdead==true)
{
cRat_1.Transparency=100;
//oDeadrat.Move(cRat_1.x, cRat_1.y, 5, eNoBlock, eWalkableAreas);
//oDeadrat.StopMoving();
//Wait(100);
deadrathere=true;
cRat_1.Clickable=false;
oDeadrat.Visible=true;
//cRat_1.Solid=false;
}