Check a Picture's Pixel Position w/Conditional Branch?

Status
Not open for further replies.

dinkledaberry

Veteran
Veteran
Joined
May 9, 2014
Messages
66
Reaction score
30
First Language
Olde Englishe
Primarily Uses
Is there an easy way to use a conditional branch to check a picture's position using a script call? 

Like "if screen.pictures[index] = 216, 312 then blah blah blah happens" or something like that to check a picture's current position? 

I was working on an overworld map system and this seems the easiest way to do what I had in mind. 

Any help would be greatly appreciated. :)
 

Misty

Programmer
Veteran
Joined
Sep 19, 2013
Messages
127
Reaction score
12
First Language
English
Primarily Uses
I am not really sure if this will help, but maybe you could use map coordinators and apply the variables to the conditional. You could have the picture display from the conditional variable branch and use a parallel process to continuously check your position within a textbox.

http://finalbossblues.com/rmvxace-using-map-coordinates-p2/
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,352
Reaction score
11,942
First Language
English
Primarily Uses
RMMV
screen.pictures[index].x and screen.pictures[index].y should do it for you. I'm not sure whether this takes the origin into account.
 

dinkledaberry

Veteran
Veteran
Joined
May 9, 2014
Messages
66
Reaction score
30
First Language
Olde Englishe
Primarily Uses
I am not really sure if this will help, but maybe you could use map coordinators and apply the variables to the conditional. You could have the picture display from the conditional variable branch and use a parallel process to continuously check your position within a textbox.

http://finalbossblues.com/rmvxace-using-map-coordinates-p2/
Thanks for the link! Not exactly what I was looking for but reviewing this info reminded me that you can set a variable to an event's screen x and y pixel positions. Which should be useful for what I'm doing so I appreciate the help!

screen.pictures[index].x and screen.pictures[index].y should do it for you. I'm not sure whether this takes the origin into account.
Seems to work perfect actually! Thanks!

Although I have a followup question that I came across while playtesting:

Is there a way to set a picture to move at a certain rate instead of within a certain timeframe?

What I'm working on involves a moving picture that stops every now and then at random intervals when certain events happen and then continues its path to the indicated point.

I was using a random "move picture" event that sends the picture to its current location to stop it in its tracks before using another "move picture" event to put it back on its path but calculating the time rate is rather bothersome when trying to keep the picture's speed consistent. Am I explaining that right?

Let me know what you think...
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
38,352
Reaction score
11,942
First Language
English
Primarily Uses
RMMV
You should be able to do a bit of math with the distance and the speed to work out the timeframe. If you want to stop and start it a few times, you'll need to do that a few times. And you'll need to use a script call to move picture as I don't think you can use a variable for the time/frames.
 

dinkledaberry

Veteran
Veteran
Joined
May 9, 2014
Messages
66
Reaction score
30
First Language
Olde Englishe
Primarily Uses
You should be able to do a bit of math with the distance and the speed to work out the timeframe. If you want to stop and start it a few times, you'll need to do that a few times. And you'll need to use a script call to move picture as I don't think you can use a variable for the time/frames.
I was afraid of that. I figured I'd have to use a script call since I'll probably need to use a variable depending on the distances I randomly stop the picture at. No problem there. But the math... I've always been bad at real-life applications. I just hope I can get the math right to keep this movement consistent.

Hmmm...The whole reason I was using pictures was because of the pixel movement. I don't suppose you'd know of an easy way to substitute an on-map event with what I'm attempting? Is it even possible to stop an event completely in its tracks without it finishing its grid movement? Or moving it pixel by pixel? I'll probably have to end up calculating the picture movement.

EDIT: Oh wait. This math is easy isn't it? So if I had two points on my map I wanted the picture to travel between in...let's say 400 frames, I would just use the distance formula to find the distance and put that in a variable. Then after I stop the picture's movement and start it up again I would just use the distance formula again with the picture's current position and my original destination and store that in a new variable. Then I'd cross-multiply and divide that new distance variable with my original 400 frames rate and original distance variable to find the new rate I set the move picture script call with huh? (At least I think that's right...) Are the variables in RPG Maker accurate enough to ensure consistent speed this way?

EDIT2: Yup! That did it. Tried it out after waking up and its good to go. I had to round the numbers to ensure the picture would actually stop moving when it got to its destination (Which is weird since you think it wouldn't keep going but it does. Huh...) but it works perfectly as a foundation that I can build off of. Thanks for the help Shaz and ZEFK! Feel free to close topic cuz' this issue is solved.
 
Last edited by a moderator:
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Is the "2 status updates 24h" still in effect?
My first attempt at Pixel Art :blink::) (I have no idea what I'm doing but I'm doing it)
Plugin instructions: *exists*
Plugin: What did he say? *error*
I feel like it's about time I share all the result of my experiment project here. But there's a lot of it.
Me and brother have an ongoing rivalry. We constantly fight for the High Score in Galaga on our arcade cabinet. Today I take back the top with 239,000. He'll be back. (No-Fire glitch is banned)

Forum statistics

Threads
93,723
Messages
914,937
Members
123,329
Latest member
ChrisCKC
Top