Skip to main content
15 votes
Accepted

How to randomly place entities that don't overlap?

A Poisson-Disk sampling distribution will allow you to select random points a minimum distance apart. Your situation is similar to this question, but since your trees aren't idealized points you'll ...
Pikalek's user avatar
  • 12.4k
7 votes
Accepted

In an object-oriented game engine, should there be seperate classes for objects with and without parents?

what should the parent of the root Instance in the hierarchy be? Nothing. Does Instances without parent make sense? If you, for example, might want a factory that ...
Theraot's user avatar
  • 27.2k
3 votes
Accepted

Change parent object on instantiation

For me it should be done in this way: What we need: A throw point - a Transform attached to mode's palm of hand Throw animation (Option A ) A event that will be fired during the throw animation, at ...
tc07's user avatar
  • 455
3 votes
Accepted

Unity2D: Vector3.Lerp - smooth movement

Before I go into the code, I want to go over how Lerp works. Vector3.Lerp(Vector3 start,Vector3 end, float fraction); The above code will return a Vector3 that ...
aagic's user avatar
  • 46
2 votes

How to have random and different colors on multiple objects with one material?

You can change the color of the same material, on different objects, from script. Do the following: Create a materialand assign it to the target game object. Create a new C# script, and copy in the ...
Shuvro Sarkar's user avatar
2 votes
Accepted

A logic error. canvas: balls physics, bounce

To figure out what is going on, I started looking at the code that moves the balls. In this case it is physics (fisicas). I see ...
Theraot's user avatar
  • 27.2k
2 votes

Tree of objects in 2D space - children relative to parent

With transform hierarchies (trees), the normal method is to work your way up or down the tree, applying any transformations of the parent to the child, at each level, till you have processed ...
Engineer's user avatar
  • 30k
2 votes
Accepted

Evenly distribution of 2 or more shapes given their x and y points inside a bounding box

If you have a set of bounding boxes and the first and last one shouldn't get moved, then you can create a line out of the center points of these two and line the ither center points up with it. So, ...
Bálint's user avatar
  • 14.9k
2 votes

LIBGDX - group as child of an actor?

We don't know which things are containers and what they can contain. But let's assume your world work this way: Empires can contains Kingdoms, but also Cities (which are not contained by any ...
Sebastien Servouze's user avatar
2 votes

Instantiating a GameObject at my desired position not working

So the answer was that I needed to set the localPosition after setting the parent. I thought everything was correctly calculated at runtime (taking parental relationships into account), but ...
Andrew Alexander's user avatar
2 votes
Accepted

C++ create array of multiple types

When you have an array of type Entity then you can only call methods on the entries which are declared in the class Entity. If ...
Philipp's user avatar
  • 120k
2 votes

Can a character interact well with surroundings in-game?

Yes. This is all doable. Limitations in games most of the time come from features being too heavy for the physics engine ("we can't simulate that many bodies at once, otherwise it trashed the ...
Vaillancourt's user avatar
  • 16.3k
2 votes
Accepted

Calculate coordinates of boundaries containing group of objects

This is a broad question, so a broad answer is required. You can follow up individual implementations / algorithms yourself, and post separate questions if you need to. The basic approach for games ...
Engineer's user avatar
  • 30k
2 votes
Accepted

Painter's theorem inside and outside test

I'm not familiar with the exact situation being discussed here — it's been a while since I've worked with plane equations — but in general, much of the math in computer graphics has opportunities to ...
Kevin Reid's user avatar
  • 5,508
1 vote
Accepted

How to set keys for emission on/off for a prefab?

If it were me, working on Unity or not, I would have two classes/prefabs and swap. The idea is that the active object will be replaced with a different object that is inactive. Simple. To do that, in ...
Theraot's user avatar
  • 27.2k
1 vote

Wonky perlin noise

Found The answer! My linear interpolation values were just flipped and when I flipped them back, instead of being inverted and creating layers, it was reverted to its normal state. Code Changed: <...
Braden McPhail's user avatar
1 vote

Querying game objects in real-time

It all depends on the query types, but broadly speaking... If world is very large, as in an MMO, use a database, whether SQL or noSQL style is up to you, but it is a lot simpler to read (with your ...
Engineer's user avatar
  • 30k
1 vote

Why has my object detached itself from the parent?

Your normals are flipped, search for shortcut or how to flip normals in Blender, that is causing invisible faces. Make sure your sword is parented correctly to the bone that is holding the sword. I ...
Candid Moon _Max_'s user avatar
1 vote
Accepted

C++: passing gameobject as a parameter and then into vector

Your crashes is mostly because of improper handling of the object's ownership. When you add something to a collection, you should clearly understand who's owning the object. Is that handler owns the ...
Vlad's user avatar
  • 306
1 vote

C++ create array of multiple types

In this case you want to use virtual functions on the base class like so: class Entity // base class { virtual void ai(Entity n){} } Even though this is just ...
Jay's user avatar
  • 810
1 vote
Accepted

Read access violation, pointer was nullprt

As far as I can see you never initialise your pointer. You declare Splav *sp but never create a new Splav instance which means ...
Mikael's user avatar
  • 444
1 vote
Accepted

Sprite/Object/Room limits in GameMaker 8.1?

GM 8.1 Lite has a lot of limitations. And there is no any reason to use it. Documentation says: Standard Edition contains considerably more functionality and does not display any logos or popup ...
Dmi7ry's user avatar
  • 1,050
1 vote

Equal objects with independent variables in Game Maker?

There are many ways to do it. For example: obj_runner Create ...
Dmi7ry's user avatar
  • 1,050
1 vote
Accepted

Difference between Object.Destroy() and GameObject.Destroy() in Unity

None. GameObject.Destroy() is inherited from Object.Destroy(). Both statements refer to the same method. This is not explicitly ...
CosmicGiant's user avatar
  • 2,104
1 vote

Make character move behind object

This is one of the main reasons why we don't use tiles for objects, like trees. Sprites are much easier to manage. Anyhow, most engines, frameworks and APIs allow you to render the sprites based on a ...
Bálint's user avatar
  • 14.9k
1 vote

How to detect when object A In point B place

Unless you're running on extremely slow hardware or dealing with incredibly fast objects, checking per-frame should be fine as long as you aren't looking for an exact hit. It's best to check the ...
Steve Harding's user avatar
1 vote
Accepted

How to prevent clicking through object in GameMaker

You could check in obj_gameover whether the ball is clicked too or not. Something like: Left Pressed (obj_gameover): ...
German Gorodnev's user avatar
1 vote

Identify objects of the same type from each other, even between game restarts?

I would suggest using GUID - it is widely used and pretty much every language/lib has an implementation, python included. A common practice is to express it as hexadecimal string, possibly also ...
wondra's user avatar
  • 4,930
1 vote
Accepted

How do I pass my objects to the update method?

As long as all of your mentioned methods are in the same class, you do not need to pass your objects to the methods - if you just declare your objects in that class. That is the normal way to do it. ...
Djindjidj's user avatar
  • 406

Only top scored, non community-wiki answers of a minimum length are eligible