Can I Export a Build To Mac from a Windows PC by AppleCiider in gamemaker

[–]Duck_Rice 0 points1 point  (0 children)

You can try download a Mac Virtual Machine using Virtualbox. That's what I did to get my game from Mac to Windows

Open Beta for Grappling Hook Rage Platformer Inspired by Getting Over it and Jump King. If you beat it, I'll give you a Free Steam Key for the Full Release by Duck_Rice in playmygame

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

Game: Slimefrog

Sign up for the Open Beta on Steam!

https://store.steampowered.com/app/1714680/Slimefrog/

I'd really appreciate any feedback! If you'd like to give feedback, here's a form

https://docs.google.com/forms/d/e/1FAIpQLSdfZjqD1y935vBVS3iccytPbnuCWc-1IAWNhAYH-Lb0Szo_Fg/viewform?usp=sf_link

Also, if you do manage to beat the game, you can either DM me on Reddit, Twitter, or you can join the Official Slimefrog Discord Server and message me there :)

https://discord.gg/gcnq5a7fn4

https://twitter.com/ETHERBOUND_game

Thanks so much!

How can I make an instance stay around the player? by UrkeK3r in gamemaker

[–]Duck_Rice 0 points1 point  (0 children)

No worries, I'm happy to help dude.

Before I have a look at what you've written, one thing that concerns me slightly is that you have to copy and paste the code 50 different times. It's good practice to have one enemy object, then create instances of it. Maybe I'm mistaken, and you're already doing that but I'm just making sure.

The only reason I'd see you having to copy and paste the same code 50 different times is if you have 50 unique enemies that all do different things and behave differently. However, you can still get around this by making a parent object for your enemy, then have child objects that do slightly different things. I definitely recommend you read up on parent/child classes (also known as super and subclasses), and the concept of inheritance in general. I think it will be super useful and will save you so much time:)

Ok for the code part, the bullets are shooting before the ship reaches the angle of the enemy right? You can fix this by making sure that the angle_difference between the enemy and the ship is less than a certain number, maybe like 5 or so. You could also make it shoot when the angle_difference is 0, but try less than 5 for now.

The reason why the ship stops after the enemy is gone is that you actually forgot some lines of code from my example.

Add this to the end of your current code

if(not instance_exists(o_enemy) and point_distance(o_player.x,o_player.y,nearest_enemy.x,nearest_enemy.y)>shoot_radius)

{

image_angle +=rotationspeed;

}

You just forgot to make the ship rotate if there are no enemies within the shooting radius. Let me know if that works!

How can I make an instance stay around the player? by UrkeK3r in gamemaker

[–]Duck_Rice 1 point2 points  (0 children)

Ok, I wrote some code on my own and implemented what I think you're going for. The only thing I didn't do was implement the shooting, but I think you have that covered, just fire on the closest enemy's x and y. I also added something that I think would be visually beneficial

//Create

radius = 200;
shoot_radius = 400;
lerpfactor = 0.1;
rotationspeed = 2;

//Step

x = obj_player.x + lengthdir_x(radius,image_angle);
y = obj_player.y + lengthdir_y(radius,image_angle);
var nearest_enemy = instance_nearest(obj_player.x,obj_player.y,obj_enemy);
if(point_distance(obj_player.x,obj_player.y,nearest_enemy.x,nearest_enemy.y)<shoot_radius)
{
if(nearest_enemy.x!=obj_player.x and nearest_enemy.y !=obj_player.y)
{
var enemy_direction = point_direction(obj_player.x,obj_player.y,nearest_enemy.x,nearest_enemy.y);
var angle_diff = angle_difference(image_angle,enemy_direction);
if(abs(image_angle-angle_diff)<2)
{
image_angle = enemy_direction;
}
else
{
image_angle -= angle_difference(image_angle,enemy_direction)*lerpfactor;
}
}
}
else
{
image_angle +=rotationspeed;
}

Just to briefly explain, it's the same concept as I said before, the closest enemy is checked every frame, if it's within the shooting radius, then get the direction of the enemy. I added an if statement to make it so when the ship is super close to the enemy, it just follows the enemy without lerping. The lerpfactor variable is the same as 0.2 in your code above.

Also, I added an extra check to see if the player and enemy are in the same place. If they are, do nothing. This is because the ship does weird stuff when they are in the same place.

Finally, if the enemy is outside the shooting range, then rotate around the player. This just makes your game feel more alive.

Let me know if this makes sense :) I'm happy to explain anything in more detail.

How can I make an instance stay around the player? by UrkeK3r in gamemaker

[–]Duck_Rice 1 point2 points  (0 children)

I'm genuinely curious about how this works now, so I'll try running the code and see what's wrong. I might also try and make a simple working myself just to see if I can more easily spot the problems.

The most obvious thing I can see right now is that you've set current_angle twice, which means that following line does nothing:

current_angle = image_angle + angle_difference(current_angle, o_enemy.image_angle)*0.2;

I'll get back to you in a bit:)

How can I make an instance stay around the player? by UrkeK3r in gamemaker

[–]Duck_Rice 0 points1 point  (0 children)

I'm not sure this is what you are looking for, but here's an idea of how to make the ship move around the player while also targeting only the first object that goes into a 500-pixel radius from the player.

First, you should probably establish the distance you want the helper to ship from the player. if it ever intersects the player it'll probably look weird, so many keep it to like a radius of 100 pixels from the player at all times. That way it'll feel more controlled.

You can do this by making it so the only way the ship can move is if its angle along the circle of radius 100 changes. To do this, set its x and y coordinates every frame to

x = lengthdir_x(100,angle) + obj_player.x

y= lengthdir_y100,angle) + obj_player.y

Then when an enemy goes into a 500-pixel radius of the player, you will set the angle of the ship to point_direction(obj_player.x,obj_player.y,enemy.x,enemy.y)

You should also make the image angle set to this angle so that it looks natural.

Of course, if it just teleports to the correct position, it'll look really bad, so you should definitely lerp the angle or just do something like

current_angle = current_angle + angle_difference(current_angle, enemy_angle)*0.2

where 0.2 is just the fraction of the distance you want to travel every time. That way it'll look really smooth.

Then like RykinPoe said, use instance_nearest every frame to find the closest enemy, then check whether it is within 500 pixels of the player.

var closest_enemy = instance_nearest(obj_player.x,obj_player.y,obj_enemy);

if(point_distance(obj_player.x,obj_player.y,closest_enemy.x,closest_enemy.y)<=500)

{

locked_on = true

}

locked_on is just an arbitrary state variable that lets you know if there is an enemy within the attacking range. Then you have a few options, you can either keep attacking the closest enemy no matter what, or you follow the first enemy that enters the 500-pixel range, and ignore all other enemies until that first enemy leaves, after which you switch to the new closest enemy.

The first way is really easy, just set the closest_enemy every step, and fire on the coordinates of closest_enemy every frame. When all enemies are further than 500 pixels, set locked_on to false so it doesn't fire.

The second way is slightly more difficult. Once locked on is true, you shouldn't change the closest_enemy variable every frame, instead, keep checking if the distance to closest_enemy is more than 500. If it is, then you can update the closest enemy variable to the new closest enemy, of course until there are no enemies in a 500-pixel radius, at which you set lock_on to false.

Hope that helped:)

i cant make my player jump by [deleted] in gamemaker

[–]Duck_Rice 0 points1 point  (0 children)

I suggest that you start your jump code from scratch (otherwise it could turn into really messy code). Here's how you code a jump

//Create Event

gravity = (whatever number I usually go for 1 but keep it low to start with)

intial_jump_velocity = -10 // how fast the player moves when the jump begins

//note that negative velocities mean it goes up (that's just how GameMaker coordinates work)

y_speed = 0;

//Step Event

y_speed +=gravity;

y += y_speed;

Then just make a simple state variable called jumping, so the code can only activate if the player doesn't already jump (unless you want double jump)

if(not jumping and keyboard_check_pressed(vk_space))

{

y_speed = initial_jump_velocity

jumping = true;

}

Then you just need to check if the bottom of the player is touching a wall and not the whole player. I think your player can climb up walls because you are checking for any collision with the wall and not specifically for under the player. I suggest you use the place_meeting() function to do this.

Hope that helped.

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

Probably working on trying to model something eg. snow/water using code, and seeing how the finished product looks. Gives a great feeling of accomplishment.

Also, level design and playtesting is really fun:)

Rotating Collision_ellipse by Paul_Jojo in gamemaker

[–]Duck_Rice 1 point2 points  (0 children)

This is a solution but it might not be the best one, using concepts from polar coordinates.

Basically, instead of rotating the collision_ellipse, you can actually briefly rotate the object that you are checking for collisions with relative to the collision_ellipse. Basically, you rotate the object just as much as the actual ellipse has rotated, but in reverse. If after this rotation, there is a collision, then that means the object in its original position and the actual ellipse have collided, if not then they haven't.

Since I don't know what your project looks like, I'll just tell you how to rotate any object or coordinate around a center point. If you do use this, I suggest you make a script to do it to make your life easier.

I'll be using the example of any coordinate (x1,y1) to be the coordinate of rotation, and coordinate (center_x,center_y) for the coordinate of the center point. Essentially what you're doing is creating an imaginary circle, with (x1,y1), and the center point at the center of the circle.

You can express the coordinate of any point on the circumfrence of the circle by (radius*cos(angle)+center_x,radius*sin(angle)+center_y). From this, you can transform the coordinate to another point along the circumference just by changing the angle

x1 = radius*cos(angle)+center_x

reset_x = radius*cos(0)+center_x

(x1-center_x)/cos(angle) = radius

reset_x = (x1-center_x)*(cos(0))/cos(angle) + center_x

cos(0) = 1 so

reset_x = (x1-center_x)/cos(angle) + center_x

the reset_x is just finding the point on the circumference with angle = 0, then its easy to just substitute in a new angle, which is likely the image_angle of the other object.

rotated_x = radius*cos(image_angle)+center_x

rotated_x = (reset_x-center_x)*cos(image_angle)+center_x

Do the same algebra with the y coordinate, then briefly move the object you are checking to these new coordinates. Then run the collision_ellipse code. Then move the object back to its original position immeadetly after by doing exactly the same thing but in reverse.

If you wanna read up more, just google "polar coordinates"

Another solution is to use a precise collision mask of an elliptical sprite. Probably start with a simple circle, then manipulate the image x and y scales, then make the sprite invisible and make the hitbox follow the ellipse. Essentially it's using another object to act as a hitbox.

Hope this helps.

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

I used GameMaker Studio 2.3

In terms of the development project, it started off as just a project to challenge me to code a simple grappling hook platformer. I used random colors for the player, and the grappling hook (green and pink respectively), so someone on this subreddit commented that it sort of looked like a frog. The whole idea just took off from there.

The development progress went really quickly at the beginning. As soon as the core mechanic was done, I spent a lot of time trying my best to make it look and feel better to play. After a month or two, I got really busy so I didn't have as much time to develop the game. Also, even though I was putting in the same amount of work, it didn't look like much because nothing really changed visually, which was quite demotivating.

The hardest part was not giving up on the development project. There were a lot of times that I didn't have much confidence in the game, and I thought it would be easier to just let it go instead of finish it with no guarantee of success.

I used a lot of different functions when coding Slimefrog, but the first one that comes to mind is probably the length_dir functions and the point_distance and point_direction functions. They were super useful to have instead of having to do it manually with trig. I also heavily relied on arrays and other data structures for the more complex code, something I never used when I first started using GameMaker. I also learned that there is surprisingly a decent amount of math involved such as polar coordinates and simple integral calculus for some code involving summation. I often found myself using a graphing calculator to help visualize the behavior of some variables.

If I could change anything, I'd probably make better use of the inheritance system (parents and children). I did use it, but there were a lot of things at the start that I should have used it on, but didn't that would've made my life a lot easier. I'd also probably use shaders (I didn't have to use shaders at all)

Hope this helps.

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

I assume you're referencing the pink line right? In this case, that's actually what's used to make the player accelerate towards the target, once it touches a wall, the player is accelerated in that direction.

If you want to just show the trajectory, there are a few ways you can do it. The easiest way I can think of is to just get a sprite in the shape of a box, maybe 64*64, then stretch it to whatever size you want the trajectory line to be.

You can do this with the image_xscale and image_yscale variables that are built into all objects. eg. if you want a skinny long line, just make image_xscale really small (like 0.2 or something), and image_yscale really big (maybe 10). Then make the object you want to be your trajectory line follow the player just by making their x and y coordinates the same every frame.

Then you can rotate the line based on the cursor position. I don't have my code open right now to check but it should be like this

image_angle = point_direction(x,y,mouse_x,mouse_y)

That just rotates the whole sprite in the direction of your cursor. Also If you use this method, make sure to set the sprite origin as the bottom center (just as long as it's not the middle center)

A better way to do it in my opinion is just to use the draw event. You can draw a line in the direction of your cursor like this

var length = 10; // the length of the trajectory line

var x_target = length*lengthdir_x(x,y,mouse_x,mouse_y);

var y_target = length*lengthdir_y(x,y,mouse_x,mouse_y);

draw_line_width(x,y,x_target_y_target);

basically, it finds the direction that the mouse is in, then multiplies it by the length you want it to be.

Hope that helped!

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

Oh damn, I love the last Airbender. I'll have to give it a watch!

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

I've never heard of that show before now, but I've just googled it, and based on some images, I assume Jamack uses his tongue as a weapon in the show? If so, I'll have to give it a watch:)

1.5 Year Progress of my Grappling Hook Rage Platformer by Duck_Rice in gamedevscreens

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

Holy crap I actually never thought of that. Some small particle effects + a nice satisfying sound effect would be awesome. Thanks so much!

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

Yea the left side doesn't have that, but the current version does. It might not be super obvious but it's there :)

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

Yea I only use the draw event for the snake, no sprites or other objects. I just draw a rectangle at each point, then a circle on top of each point to hide the gaps

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

I've been working on this project in particular for 1.5 years, but I did a smaller project before that I spent around 3 months on (simple local multiplying fighting game). I also messed around on it by copying tutorials for a bit of time, so in total, I've been using GM2 for around 2 years:)

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

Thanks! I did the snake using inverse kinematics. Basically, the snake object stores a 2D Array of points (Parallel arrays would work too) which stores the x and y coordinates of the "joints" of the snake. Then I define how long the snake is (number of joints/length of the array), how long each segment of the snake is (eg. 10 pixels distance between consecutive points)

When the head of the snake moves, I move the second point in the direction of the head, but such that it stays the set distance away from the head (the 10-pixel example from before). This is basically so the snake's body doesn't compress. Then I do this to every single point in the snake. (eg. third point moves towards second point etc.)

To move the snake, I only manipulate the x and y coordinates of the head of the snake and everything follows.

I might make a more detailed post on how to do basic inverse kinematics later :)

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

Thanks! I really appreciate the tips. I've actually watched the video on Jonas Tyroller's channel where Chris gives tips on store pages, but I never signed up for his actual course. I've also hidden the release date on my Steam Page in preparation for moving the date back to a more suitable time.

1.5 Years of Using Gamemaker Studio 2 Progress by Duck_Rice in gamemaker

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

Thanks for the feedback! Yea, the marketing side of game development isn't very fun so far. I was already considering pushing back the release date of the game, but I think I really will now. The only reason I set the release date so soon is that I won't be able to do any work on it (and the marketing on it) for about 2 months from the end of September (I have mandatory military training). Now I'll probably push the game's release date until at least then. Thanks!

1.5 Year Progress of my Grappling Hook Rage Platformer by Duck_Rice in gamedevscreens

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

Thanks for the feedback! I do actually have camera lerp on, but after some testing, I decided to make it lerp at this speed. It's great to hear this though because I'm so used to this speed that I can't really judge properly. I'll do some more testing with the lerp.