# Object control \[file posted\]

**URL:** <https://forum.kirupa.com/t/object-control-file-posted/886>\
**Category:** Uncategorized\
**Created:** [August 1, 2002, 3:17pm UTC](https://forum.kirupa.com/t/object-control-file-posted/886 "2002-08-01T15:17:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuga](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@shuga](https://forum.kirupa.com/u/shuga)\
**Post date:** [August 1, 2002, 3:17pm UTC](https://forum.kirupa.com/t/object-control-file-posted/886/1 "2002-08-01T15:17:15Z")

</div>

here is a movie that i put together that has a lot of controls that i’m thinking about using. how do i add limits to them?

also … does anyone know how to change the color with a button press … or maybe apply a random color to the object?

thx 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2002, 3:54pm UTC](https://forum.kirupa.com/t/object-control-file-posted/886/2 "2002-08-01T15:54:04Z")

</div>

Man you’re wasting space… 🙂

```auto
on (press, keyPress "<Right>") {
	tellTarget ("") {
		with (blue) {
			_x += 10;
		}
	}
}

```

How about

```auto
on (press, keyPress "<Right>") {
	blue._x += 10;
}

```

And if you want to put a limit:

```auto
on (press, keyPress "<Right>") {
       if (_x<400) blue._x += 10;
}

```

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2002, 4:56pm UTC](https://forum.kirupa.com/t/object-control-file-posted/886/3 "2002-08-01T16:56:40Z")

</div>

you’re a genius

thx for helping a newbie scripter out!

[update]  
i tried inserting the code and it doesnt work. the ball still moves with the shorter code … so thats sweet but it doesnt stop at the bounds i’ve set

do i need to put an {else} in there?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2002, 5:56pm UTC](https://forum.kirupa.com/t/object-control-file-posted/886/4 "2002-08-01T17:56:27Z")

</div>

Oups!

```auto
on (press, keyPress "") {
       if (blue._x<400) blue._x += 10;
}

```

Sorry 🙂

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 1, 2002, 6:28pm UTC](https://forum.kirupa.com/t/object-control-file-posted/886/5 "2002-08-01T18:28:54Z")

</div>

it works!

thank you
