[ACE] COLLISIONS BETWEEN PICTURES AND EVENTS/MAP

Posts

Pages: 1
Rave
Even newspapers have those nowadays.
290
I'm writing a minigame that is partially done with events and partially with pictures and I'd like to know how can I know if picture is overlapping with events. As I'm no stranger to RGSS, some RGSS snippet would work, though I'd prefer to keep to events. Simple bounding box collision would work best, but I don't know how to get dimensions of picture displayed and its x/y, same for events, so some RGSS magic may be needed here.
If you set picture placement using variables, you can check to see if they overlap variables set to the x and y of an event.

So instead of setting standard numbers for the picture, instead set to an x and y variable set (say, Picture X and Picture Y) and then change the numbers of those two variables to change the position of the picture.

After that create two new variables (say, Event X and Event Y) and use the variable controls to set them equal to the X and Y position of the event you want to check the position of. Use conditional branches to check if Picture X is equal to Event X and Picture Y is equal to Event Y. If yes, then put in the collision eventing. If not, the leave a wait and then jump back to the start of the event to check again. Easy enough~

Variables are life. Variables are love.
Rave
Even newspapers have those nowadays.
290
Yeah, thought about that. One problem with this approach: It will only make check between two points, not whole bounding box of event/picture. So not really a solution to my problem.

//edit:
Yeah... that would require you to have another set of variables set to +/- Picture X (the other side) and Picture Y, checking then to see if the hero is at any time between Picture X 1 and Picture X 2, Picture Y 1 and Picture Y 2, Picture Y 1 and Picture X 2 and Picture X 1 and Picture Y 2.
Basically plotting the 4 corners of the image (easy enough to do if you know the width/height of said image. It'd be X/Y - the width and height) and then checking if the hero at any point overlaps those numbers.
Rave
Even newspapers have those nowadays.
290
Well, I want solution that scales well, so I need some way to dynamically get width/height of an image, after possible transformations (rotations, scaling, etc.).
There is a 95% chance that there is no solution except to track everything with variables. There are no commands in RPGmaker to track anything about pictures, only to show them. Which is why you need to use variables for all calculations. Like with most ideas being created with RPGmaker you need to make them fit the limitations of the engine. It doesn't work the other way around.

Unless there is some RGSS command, this is impossible to easily do with events. http://rpgmaker.net/tutorials/498/ part of this tutorial is related to hit detection of pictures. I'd say you should get cracking on that or abandon your idea(or RPGmaker) altogether.
Is the image moving? If not, perhaps just do the check by tile instead. If so, then perhaps make the images around the same sizes so that they're easy to check. Frankly, you're going to have to either find a script snippet of some sort or work around it. I'm not sure how likely you are to find said snippet though. I'm more of an eventer than scripter, but maybe if you add "Script needed" in the topic header you might draw one in to help? (Use the Edit button at the bottom of the page to edit thread titles - you'd be surprised how many people don't know about this ;p )
Pages: 1