How to make a object follow another object around walls game maker language - game-maker-language

So, i want an object to follow another one. But if the player object gets to far ahead the other one gets stuck behind a wall. So if you go round a corner and the following object gets trapped because it cant follow you since its trying to move towards the player. Which cause it to get stuck against a wall. The code i currently have for it is:
"Create Event"
path = path_add();
"Step Event"
mp_potential_path_object(path, obj_unit_1.x, obj_unit_1.y, 1, 4, obj_border);
path_start(path, 1, 0, 0);
If anyone has already posted about this please mention, thanks

Without knowing additional details for how your project/objects are laid out, I am going to offer just general idea type solutions.
1) On collision with the wall object, you can try to find the edge of the wall object using the sprite's size and add that as a point to move towards. (assuming the wall's aren't tiled and there's another wall there)
2) You can make a backup path of the player's movement, and have the following object follow that path. Assuming the path the player took is still clear and able to be moved through, any path the player moved through should be valid for the following object as well.
3) Not sure if it's in keeping with the mechanics of your game, but some game (like in diablo 3) if your follower/pets gets too far behind the player, they just auto teleport next to the player's location.

Related

MRTK v2, how do you make an object dragged by the pointer, stay straight out from the controller?

In the MRTK v2 HandInteractionExamples.unity, when you drag an object with the controller, it acts like it is connected to a fishing line, where pointing the controller in a different direction curves the pointer line, and the object doesn't stay in front of the controller.
The Cliff House in Microsoft's MR Home, has the type of action I am trying to duplicate. You click on an object with the controller and drag it around. The object lags a little bit as it lerps to the new position, but it ends up straight out from the controller. How do I duplicate that control in the examples they provide?
I have made adjustments in a new profile I created, and have modified the DefaultControllerPointer code directly, but to no avail. I am not finding anything in the forums that has helped.
This sounds a lot like https://github.com/microsoft/MixedRealityToolkit-Unity/issues/5203, which is something that the MRTK team also observed in some internal builds. Looking at HandInteractionExamples in the latest code in the mrtk_development branch (as of 8/8/2019), this should be addressed.
See if you can grab the latest code from mrtk_development - this should make its way into a new release in the near future.

Pyqt Custom QPolygon getting deleted: RuntimeError: wrapped C/C++ object of type ImagePolygon has been deleted

I have a program which loads multiple images and each image has an array of polygons which are represented by a custom QGraphicsPolygon item. I load 1 image at a time with its respective polygons into two QGraphicsScene (new QGraphicsScene on each load). The problem I am encountering is that after switching between image a couple times I get the following error:
"RuntimeError: wrapped C/C++ object of type ImagePolygon has been deleted". This implementation used to work well, but I have added a lot of stuff to the program since and now I get the error.
I know that I am never loosing my references to the custom QGraphicsPolygons and the only thing that is getting deleted inside them is the polygon itself. All other membervariables stay intact. Unfortunately I have not been able to pinpoint the exact region of the code where the polygon inside the QGraphicsPolygon gets deleted and the code is too long to post here.
I have also tried to simple set a new QPolygon to the QGraphicsPolygon item each time I add it to the scene, but this gives me the same error.
Please let me know if anybody knows what could be deleting this item. Keep in my I am never loosing reference to the QGraphicsPolygonItem.
I would also appreciate if somebody knew of a good way to debug this. I am sure I could fix the error if I could find it.
Thank you in advance
After a lot of testing I think I found the problem. Since in my implementation I delete the QGraphicsScene everytime I show a new image, I believe this was deleting the polygons as well. I don't know why this was not happening before, but I managed to fix it by first removing all items from the scene. I had to iterate through the items, because using the clear() method in the scene deletes them.

fabricjs 1.6.3: why active object is always shown on top

good demo of my problem: http://fabricjs.com/hovering
If you select any item, it is displayed on top.
In earlier versions (1.5.0 - 1.6.2) this problem does not exist.
Sorry for bad English.
If you dont want thie behaviour, you can set the preserveObjectStacking to true. Check the docs here: http://fabricjs.com/docs/fabric.Canvas.html
However, there is this one issue with background objects, so beware https://github.com/kangax/fabric.js/issues/3095
Hopefully, they'll push a fix soon otherwise your last resort would be going back to 1.6.2.
I believe that is meant as a convenience for the user. Although the object moves to the front while selected, as soon as it is deselected, it falls back to its original z-order.
You can test this out at the hovering demo you linked. Superimpose two objects and determine which is front of the other then select and deselect the object in the back. When you hover over them, the order should still be observed to be the same.

What is the difference between Test Objects and Runtime Objects in QTP? Is the given explanation correct?

On a blog about QTP, the following is stated:
"All software applications and websites are getting developed using many different components or small units (e.g textbox control in vb, input tag in HTML, webbrowser contorl in .net) which can be called as Objects.
Some of the properties can be changed during run-time. These are known as RO (Runtime object) properties. And some of them can not be changed. They are known as TO (Test Object) properties."
Is this explanation correct?
To understand the difference between Test Objects and Runtime Objects, it helps to think outside the computer for a moment.
Imagine, if you will, that you're sitting at your desk, and you are thirsty. But you can't go to the breakroom yourself to get a drink from the soda machine. So, instead you grab an intern, give him some coins and send him to the breakroom to get you a drink.
This particular intern is very new, so you have to explain to the intern exactly what you want them to do step by step.
Your script is very simple:
1) go to "the break room".
2) go to "the machine"
2) insert coins into "the coin slot"
3) press "the Coke button".
4) bring the can back to you.
So, in your script, you have described some things.
"the break room" is the name of the room that contains the machine.
"the machine" is the name of the machine in the break room.
"the coin slot" is the name of a hole in the front of the machine.
"the Coke button" is the name of a button on the fronf of the machine.
Now, since this intern is so new, he asks you "How will I know those things when I see them?"
So, you have to describe "the break room" as "It's the last room down the hallway with the green door."
you also have to describe "the machine" as "It's the Red machine with lots of buttons on the right side"
you also describe "the coin slot" = "it's the long rectangular slot above all the buttons"
finally, you describe "the Coke button" = "It's the big white button with a Coke logo on it".
The intern writes down all these descriptions as a list on a piece of paper. The intern now has a piece of paper with names and descriptions of things that you expect him to see when he gets to the break room.
So, next the intern actually walks to the break room...
he finds the machine ...
he finds the coin slot and puts in the coins...
he searches the controls for a big white button with a Coke logo, but he cannot find one. So, he comes back to you.
"I could not find "the Coke button" as you described it," he says. As it turns out, the buttons were recently changed, and now all the buttons have a black background. You explain this to the intern, and he changes the description on his piece of paper. You send him back to try again.
So, the intern walks back to the break room...
he finds the machine...
he finds the coin slot and puts in the coins... (the machine previously spit them back out automatically, and he got them back)
he searches the controls for a "big black button with a Coke logo on it", and he finds it, and presses it.
The machine dispenses a coke.
So, he comes back and delivers your drink to you.
Now, using the above story, it should be much easier to explain the difference between Test Objects and Runtime Objects.
The intern is your test tool - QTP.
Test Objects are just Descriptions of real objects that your test tool should look for, just the same way the intern had to search for real objects (or "things") on the machine.
The list of things on the paper that your intern wrote down is like an Object Repository. Each description has a Name and the description. The script has names, and QTP looks up those names and gets the description from the OR. As an example, your instructions to your intern could look like this:
Room("the break room").machine("the machine").slot("the coin slot").insert-coins-into
Room("the break room").machine("the machine").button("the Coke button").press
Runtime Objects are the actual objects in your AUT, just the same way that there was a real physical machine, a real physical coin slot, and a real physical button to press to get a Coke. In software testing, those objects aren't physical, but they are real.
You can programmatically read your description of an object using GetTOProperty. Also, you can change the descriptions of objects by editing your Object Repository, or you can programmatically change the on the fly using .SetTOProperty() from within your code. What this does is change the description of the object your looking for - for example, if you change the description from a Coke logo to a Sprite logo, then your intern would successfully identify the button for Sprite, and your script could work with no other changes, except that you'd end up with your intern bringing you a Sprite instead of a Coke.
While you can change the descriptions, you can't change the actual real objects any more than your intern can change the coke button from black to white. However - once your intern FINDS the button - he can interact with the button by pressing it, looking at it, jiggling it, or smelling it. He just can't change it to something else. There is no SetROproperty method for objects, but you can GetROProperty, meaning once the button has been identified by it's size, color and logo, you can also ask your intern to tell you how wide it is, or if it has an "out of stock" indicator you can ask the intern to tell you if that light is on or not.
Hopefully this fully answers your question about the difference between Test Objects and Realtime Objects in QTP.
Some of the properties can be changed during run-time
Above statement is not correct.
Test Objects are the objects that are stored during recording.
Run-Time objects are the objects that is displaying in your AUT while playback your script.

DirectX 11 Adding Object to Terrain - Rastertek Tutorial

I've been working my way through the Rastertek DX11 Terrain Tutorials getting to "Tutorial 6: Height Based Movement" Ive read through it and created, complied etc and the tutorial itself is working fine.
At the end of each tutorial it suggests what to do next and I'm stuck when it suggests to
"Place an object that randomly moves around the terrain adjusting its height based on information from the quad tree." I dont have an idea of how to do this properly.
Does anyone have a suggestion of how I would go about doing this? Either a link to a tutorial that explains how to add items as well as a terrain (which I couldn't find on the site) or just pointing me in the right direction! You might have to take a peek at the code there (found here: http://rastertek.com/tertut06.zip). Right now, the closest Ive gotten to is being able to render a 3D image from a file, but when I do that it makes the terain dissapear. So I'm clearly barking up the wrong tree. I've had a google around but that's been to no avail.
Any suggestions would be great as I'm still very new to all this.

Resources