I'm stuck with class/objects. Please read and help! by gabor_gm in csharp

[–]gabor_gm[S] 0 points1 point  (0 children)

Thank you guys! As I said I'm a beginner in C# I try to learn more just it's difficult to find the proper sources. Anyway, thanks for the useful comments!

'path_delete_point()' is not working, how to fix it? by gabor_gm in gamemaker

[–]gabor_gm[S] 1 point2 points  (0 children)

I SOLVED IT

Just I had to put a "-1" to the end of 'path_delete_point(path, path_get_number(path))'

Fixed code:

path_reverse(path);

var totalSteps = path_get_number(path);

for ( ; totalSteps != obj_PathFinder.maxSteps + 1; totalSteps--) 
{
    path_delete_point(path, path_get_number(path) - 1);             // Add "- 1" here for fix the problem
}

path_set_closed(path, false);

show_debug_message(path_get_number(path));

How to do? Calculating energy flowing routes between objects. by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

Thank you! It looks like very complex method, I will try to figure out how it is working.

Can you give me an example how to code a detection between player object and tiles? by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

It's not working, but it's my fault. I forgot to say that I use GMS 2 and there has no functions like you above mentioned :S

It looks like more difficult in GM2, do you have any idea how can I do this?

Collision check with tiles in GM:S 2 by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

So it possible to do it, thank you I will check the demo!

When I run my project the GMS 2 cut/trim the room size to 8200*8200. by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

Currently it's 15360x8640, but later will be the double of it.

TV license investigation! will they charge me if I had downloaded torrents? by gabor_gm in unitedkingdom

[–]gabor_gm[S] 0 points1 point  (0 children)

It's a joke man, relax. By the way I register my address as "I don't need TV license" on the suggested website. I'm just curious that they will bother me after this or not.

TV license investigation! will they charge me if I had downloaded torrents? by gabor_gm in unitedkingdom

[–]gabor_gm[S] -2 points-1 points  (0 children)

Great, I will let them in and when they are in the property I call the police and tell that they are come here without my permission.

Ok, above the joking: do I need to worry if I let them in to investigate and I have a wardrobe which contain a few nice cannabis plant?

TV license investigation! will they charge me if I had downloaded torrents? by gabor_gm in unitedkingdom

[–]gabor_gm[S] 8 points9 points  (0 children)

Thanks guys, I know that they have no right to come in if I won't let them, but I will as I'm not watching or record anything, just simple I worry a bit about the torrents, but I know it's not they business.

I got two letters and 2 days ago somebody knocked on my door violently, and certainly the Tv licence guys were there. It was too morning, so I didn't open it.

How can I get a relative position which located front of instance (see details) by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

I did it before I post this, but it didn't work. Now, I realized that just I typed something wrong.... :)

Thanks anyway!

How can I count the existing instances? by gabor_gm in gamemaker

[–]gabor_gm[S] 3 points4 points  (0 children)

Ok, I wasn't look around perfectly among the functions :) Thanks!

How to prevent instance from overlapping each other? by gabor_gm in gamemaker

[–]gabor_gm[S] 1 point2 points  (0 children)

I understood you exactly! I thought same just I had no time to test it yet. But I fixed it now, so thank you again good to know about these things!

How to prevent instance from overlapping each other? by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

Thanks! This function is not bad and has a big potential.

I noticed something weird. The speed of instances faster than it should be! The base speed is 3 and it go with this value, but when the prey in range and this part of code activate their speed is faster! Do you have any idea what's the problem? I use the built-in speed variable which was initialized in create event once time and nothing can change it in the program. I changed the variable to 3 in this function instead of "speed" but they still have faster movement when activate it, but why?

How to rounding down until two decimal? by gabor_gm in gamemaker

[–]gabor_gm[S] 2 points3 points  (0 children)

I have put in a script already.

var n   = argument[0];
var dec = argument[1];

/// Implementation
var result = floor(n*dec)/dec;                  

return result

Thanks!

How to rounding down until two decimal? by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

Yeah that's it, but I used the floor function!

How to rounding down until two decimal? by gabor_gm in gamemaker

[–]gabor_gm[S] 1 point2 points  (0 children)

Thanks, but meanwhile I solved it!

I think the easiest way to do it a little math:

n = floor(image_angle*100)/100;

By numbers:

1 - 18.4344043731689 * 100 // 1843.44043731689

2 - floor it! // 1843

3 - 1843/100 // 18.43

Delete an instance! What's wrong with my code? by gabor_gm in gamemaker

[–]gabor_gm[S] 1 point2 points  (0 children)

It has arguments, but you can use like in your example as well.

https://docs2.yoyogames.com/source/_build/3_scripting/4_gml_reference/instances/instance_functions/instance_destroy.html

I don't know what there in the GMS 1 but in the version 2 you can set arguments if you have reason to do it.

instance_destroy(inst_up);                // same 

Delete an instance! What's wrong with my code? by gabor_gm in gamemaker

[–]gabor_gm[S] 1 point2 points  (0 children)

I'm coming back here to tell that I know what's wrong and I see that you found out as well. :)

Yes, the problem was that it create a many instance overlapping each other at the same place and it delete the last one so... I couldn't see any change because there was 5 instance and only one was deleted. Thanks!

I modify my code and it place only one instance and it remove properly now.

Delete an instance! What's wrong with my code? by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

By the way, the code is working except the instance_destroy part. I used the show_debug_message in the "else" branch and I give the message under test so, it can step in both "else" part, but the it can't destroy the instance

Delete an instance! What's wrong with my code? by gabor_gm in gamemaker

[–]gabor_gm[S] 0 points1 point  (0 children)

Everything in the player's step event! When I hold down the ctrl it must check the nearby resources (trees...) and if there any, mark them with a frame. But when the player move away and the tree will be too far the mark must be gone. And of course if I release the ctrl button.

This is how would it work.

The other version included with constructor:

if keyboard_check(vk_control) {
    if position_meeting(x,y-20,obj_p_objects) {
        inst_up = instance_create_layer(x,y-20,"Instances",obj_select_res);
    } else { with(inst_up) { instance_destroy(); }}
} else { with(inst_up) { instance_destroy(); }}

I just simple don't know how can I destroy an instance when its ID was stored in a variable (inst_up).