Jump to content


Photo

another problem


  • Please log in to reply
7 replies to this topic

#1 mironic

mironic

    GMC Member

  • New Member
  • 783 posts

Posted 20 March 2012 - 07:47 PM

Building Loader.

Random = choose(1,2)
{
if Random = 1 then
object_index = Building1
if Random = 2 then
object_index = building2
}
image_speed = 0

O.o it says "Cannot assign to variable"

Edited by mironic, 20 March 2012 - 07:48 PM.

  • 0

#2 twelveways

twelveways

    GMC Member

  • GMC Member
  • 1383 posts

Posted 20 March 2012 - 07:49 PM

You cant change object_index
  • 0

#3 mironic

mironic

    GMC Member

  • New Member
  • 783 posts

Posted 20 March 2012 - 08:36 PM

You cant change object_index

nevermind i figured it out XD

and yes you can just a bit of a longer code...
but maybe you can help me with another option?


i have a few npcs on a paths.

but how would i make them detect which direction they are going to they can face the right direction?

image_xscale = sign(Somethinggoeshere);
?
  • 0

#4 Noele

Noele

    GMC Mentor

  • GMC Member
  • 2406 posts
  • Version:GM8.1

Posted 20 March 2012 - 08:44 PM

When an instance follows a path its direction variable is updated accordingly. Thus you can use the direction to set the sprite direction.
E.G.
if(direction div(180) == 0){
  image_angle = 0; // right
}else{
  image_angle = -1; // left
}

  • 0

#5 mironic

mironic

    GMC Member

  • New Member
  • 783 posts

Posted 20 March 2012 - 08:50 PM

When an instance follows a path its direction variable is updated accordingly. Thus you can use the direction to set the sprite direction.
E.G.

if(direction div(180) == 0){
  image_angle = 0; // right
}else{
  image_angle = -1; // left
}

lol that dont work :|
  • 0

#6 LOS.A

LOS.A

    GMC Member

  • GMC Member
  • 597 posts
  • Version:GM8

Posted 20 March 2012 - 09:25 PM

Change "0" to "1" and "image_angle" to "image_xscale".
  • 0

#7 mironic

mironic

    GMC Member

  • New Member
  • 783 posts

Posted 20 March 2012 - 10:22 PM

Change "0" to "1" and "image_angle" to "image_xscale".

She Moonwalks still... and only changes direction when moving up or down... not left or right...
  • 0

#8 LOS.A

LOS.A

    GMC Member

  • GMC Member
  • 597 posts
  • Version:GM8

Posted 21 March 2012 - 03:55 PM

Try the following instead:
if (hspeed != 0)
    image_xscale = sign(hspeed)

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users