AGS & Frogger

Started by AnasAbdin, Mon 29/08/2011 10:11:34

Previous topic - Next topic

AnasAbdin

okay.. I'm trying to create a mini frogger game in here, only the river part..

The logs are objects...
but should I use the killer river as a region? and in this case, how do I deactivate it while the player is standing on the object  ???
I think it's better to use an interaction rather than walking between logs.. so when the player interacts with a log, a hopping animation starts, if he lands on the log (object) he moves along with it waiting for the next hop ( I can't believe I'm actually explaining frogger hehe).... landing on water ... dies...

I can't seem to find a way to treat the object like a "moving region" if you know what I mean..
(are there any moving regions in ags I haven't heard about??)

I'd really use your help

-Edit: I just thought I might create objects for teh logs, and objects for the water! the catch is I still can't decide whether he WALKs or Interacts with the objects.. :S

Wyz

#1
You can code it yourself using the global loop. You'll get something like this: (untested)
Code: ags

// I gather you already have these:
function region1_WalksOn()
{
}

function region1_WalksOff()
{
}

// We code a walk on and off function for the objects as well

function WalksOn(this Object *)
{
}

function WalksOff(this Object *)
{
}

Object *last_object;
LocationType last_location;
function repeatedly_execute()
{
  Object *o = Object.GetAtScreenXY(player.x - GetViewportX(), player.y - GetViewportY());
  Region *rr = Region.GetAtScreenXY(player.x, player.y);

  if (o == null)
  {
    if (last_location == eLocationObject)
    {
      last_location = eLocationNothing;
      if (last_object != null) last_object.WalksOff();
      rr.RunInteraction(1);
    }
  }
  else
  {
    if (last_location == eLocationNothing)
    {
      last_location = eLocationObject;
      rr.RunInteraction(2);
      last_object = o;
      o.WalksOn();
    }
  }
}


edit:
fucking auto txt-style spelling fuck
Life is like an adventure without the pixel hunts.

SMF spam blocked by CleanTalk