Another object control question

i have remade the file and now i am trying to set the limits so the user can zoom in once and zoom out once from the center … that is to say i want the scale values to start at 100 and drop to 50 or raise to 150. b/c i don’t want it to get too big or too small.

i don’t think i understand how the player calculates _xscale and _yscale and i think i have the > or < facing the wrong way.

can someone please help :slight_smile:

thx so much

I tried rescripting some of your code, tell me if you like and if you want more help. I attached a new file to this post, download it a check it.

you da man … omgosh i love this forum

k now that thats working i am wondering about the boundaries i have set in the movie. currently when the centerpoint of the symbol blue reaches the bounds it stops. to make it look like it stays within the bounds all the time i could move the bounds further inward and move the line out so the boundaries were not actually where the visible blue line is. but is there a way to do that in code so that the _x boundary is at 300 and the line is at 300 as well and the edge of the symbol stops at 300 rather than the center of the symbol?

thx very much

take out the _width of your object in your test.

pom :asian:

Well you first off might want to try by changing the center of the movieclip to the outside of the movieclip. Then just try adding and modifing the code that I gave you to accompanie your specified numbers.

Hope this helps

Kyle

pom … there is no _width defined in my object. i don’t understand.

_width and _height are properties of your movie clip. You don’t have to calculate them or anything. They refer (of course) to the width and the heigth of the movie clip.

Now imagine that we want the ball to go up until its top gets to the limit. For the moment, the code is

on (press, keyPress "<Up>") {
	if (blue._y>100) blue._y -= 10;
}

This means that when the center of the movie clip (the center of the ball) gets to the _y 100, you can’t move it up. But in fact, we want to move it up until its top reaches this position. So we have to calculate the position of the top of the clip.

Now if the clip is centered, the top will be half the height of the movie clip higher than the center, right? That’s why the code has to become

on (press, keyPress "<Up>") {
	if (blue._y>100**+blue._height/2**) {
		blue._y -= 10;
	}
}

You can do the exact same left and right with the _width property.

Notice that the little green circle makes this whole thing fail, because the clip is no longer centered.

pom :asian:

thanks so much pom for your patience … i’m glad you’re so good at explaining this stuff … i understand !!

yeah!!

yeah … i understand about the lil green ball …i put that on there so it would be easy to see the rotate funcion i put in there.

thx again for all your help

[update]
i put the code into the fla

on (press, keyPress “<Down>”) {
if (blue._y>300-blue._height/2) {
blue._y += 10;
}
}

up and left work … but right and down don’t
i checked my pluses and minuses … they look correct to me … i don’t understand what’s going on

heres the file as it is currently with the code i’ve inserted

thx

That’s not the good fla, shuga.

pom :asian:

i got it to work. i had the > and the < switched the wrong way on the bottom and left buttons. thx very much for all of your help