• Game Maker - Discussion
    132 replies, posted
[video=youtube;x0jUPaNi9HQ]http://www.youtube.com/watch?v=x0jUPaNi9HQ[/video] idk what I want to do with this yet. Any ideas?
[QUOTE=Jebus;44078439]Ah yeah, a switch makes it much neater and easier. Thanks! I hadn't used one before, but now I understand it. Cheers. Here's another stupid question! Best method of movement for a top-down game? For some reason I really dislike using speed variables and would much rather manipulate the x and y variables. It just feels nicer and seems better. However, let's say I've got a 32*32 object moving around a 32px maze surrounded made up of 32*32 blocks. I'm just fiddling around and found that something like this: if place_free(0,movespeed) y += movespeed Works well at low speeds to detect collisions. As in, say movespeed = 4; if the place 4 pixels above the object is free, jump up 4 pixels. However, at higher speeds this obviously leads to problems, as the object can be checking for example 16 pixels above itself, and stopping at a wall 16 pixels too early. What are your suggestions here? I've actually been looking into this a fair bit and can not for the life of me find a good example that doesn't use hspeed and vspeed to control the object.[/QUOTE] I ran into the problem with objects stopping too far from walls. My code checks if there's a collision and then gets the maximum move distance 1 pixel at a time before it actually moves the character. I'm not sure if it's bad that it potentially does x collision checks (whatever # vspeed or hspeed is set to), but it works for my basic top-down rpg collision. [CODE] //right,east collision if (hspeed>0 and !place_empty(x+hspeed, y)) { var hor_dist=0; while (!place_empty(x+(hspeed-hor_dist), y)) hor_dist++; x-=hor_dist; } //left,west collision if (hspeed<0 and !place_empty(x+hspeed, y)) { var hor_dist=0; while (!place_empty(x+(hspeed+hor_dist), y)) hor_dist++; x+=hor_dist; } //down,south collision if (vspeed>0 and !place_empty(x, y+vspeed)) { var ver_dist=0; while (!place_empty(x, y+(vspeed-ver_dist))) ver_dist++; y-=ver_dist; } //up,north collision if (vspeed<0 and !place_empty(x, y+vspeed)) { var ver_dist=0; while (!place_empty(x, y+(vspeed+ver_dist))) ver_dist++; y+=ver_dist; }[/CODE] IDK if you need to specify vertical or horizontal distance but I think it's safer for corner collisions. I'm really liking my new game now that it has smooth collisions and my character doesn't moonwalk. I really like how a small amount of code can make the game feel so good.
Found something wrong in my last post. It turns out objects can skip past each other if their collision boxes are small enough. Not sure how to resolve this without adding looping collision checks for every number between 0 and vspeed/hspeed. This is fine for my game so far, but maybe[?] not good in longer term. Edit: Sorry for double posting don't know how automerge works
Recently worked on a Flappy Bird engine called Pipes, which has a lot of features including: - Flappy Bird-style movement mechanics. - Pipe generation system. - Point system. - HUD system. - Medal system. - And MORE! I made this just for fun, but it became a half-time project for me. For right now it only supports GM 8.0, but a GM: Studio version is going to be in the works and will be released soon. Link: [url]http://gmc.yoyogames.com/index.php?showtopic=611239[/url]
[QUOTE=confinedUser;44064249]are there any excellent written tutorials for this? one of the tutorials I'm using is creating a vertically scrolling plane shooter and is telling me to use random() function inside of the value textbox and when I've tried I have gotten zero results unless I use numeric values instead of code.[/QUOTE] Well yeah, the random function takes a single numerical value. It selects a value from 0 to your specified number, and also includes decimals. You can use random_range() which takes two arguments within a range from say 15 to 25.
I need help with my enemy ai(2d platform), I want them to follow the player when he is in sight if not they just move left, right or idle also if they hit a solid object they have to go the other direction.
[QUOTE=Dude902;44083880]Found something wrong in my last post. It turns out objects can skip past each other if their collision boxes are small enough. Not sure how to resolve this without adding looping collision checks for every number between 0 and vspeed/hspeed. This is fine for my game so far, but maybe[?] not good in longer term. Edit: Sorry for double posting don't know how automerge works[/QUOTE] You could detect collisions inside a hull made out of <start> to <end>: [t]http://i.imgur.com/ldb2XKI.png[/t] There's a name to this technique, but I'm too lazy to recall it.
[QUOTE=JohnnyOnFlame;44130660]You could detect collisions inside a hull made out of <start> to <end>: [t]http://i.imgur.com/ldb2XKI.png[/t] There's a name to this technique, but I'm too lazy to recall it.[/QUOTE] Continous collision detection, specifically volume sweeping. Dude902, what do you mean with "every number between..."? Isn't it floating point? Also, CCD is quite hard to do right in the general case, but maybe you have some special conditions which would make it a lot easier.
[QUOTE=ArgvCompany;44137608]Continous collision detection, specifically volume sweeping. Dude902, what do you mean with "every number between..."? Isn't it floating point? Also, CCD is quite hard to do right in the general case, but maybe you have some special conditions which would make it a lot easier.[/QUOTE] I've been approximating it with collision checking in small intervals. For the most part my characters will move at easily divisible speeds, so it works most of the time. I didn't realize position used floating point but that would explain the rare teleporting glitches I'm getting.
[QUOTE=Dude902;44137983]I've been approximating it with collision checking in small intervals. For the most part my characters will move at easily divisible speeds, so it works most of the time. I didn't realize position used floating point but that would explain the rare teleporting glitches I'm getting.[/QUOTE] Sorry, I am not experienced at all with Game Maker, I just assumed position used floating point. Do not trust me at all on this. Anyway, so you simply decreased the step size?
[QUOTE=ArgvCompany;44138336]Sorry, I am not experienced at all with Game Maker, I just assumed position used floating point. Do not trust me at all on this. Anyway, so you simply decreased the step size?[/QUOTE] No, you're absolutely right about it using floats. [QUOTE][IMG]http://i.imgur.com/A5z4Vqj.png[/IMG][/QUOTE] I'm using looping collision checks with intervals like 0.5 or 1, but you probably shouldn't use my code as a good example. It's running at a decent speed right now but if you were to improve the accuracy with smaller intervals I don't know how it would perform.
[QUOTE=Dude902;44138795]No, you're absolutely right about it using floats. I'm using looping collision checks with intervals like 0.5 or 1, but you probably shouldn't use my code as a good example. It's running at a decent speed right now but if you were to improve the accuracy with smaller intervals I don't know how it would perform.[/QUOTE] Why exactly do you need such high precision checks? You could do some kind of interval halving where you check for collisions as usual with the exception that if no collision is detected, you run some kind of approximation test where you check if a collision within the frame could be even remotely possible. You could do this by making a bounding box for each object which fits both the object before the movement and after it. If two objects' such bounding boxes overlap, you could just run the movement in two steps. If the same thing happens there, one of those two steps is split even further into two steps. I hope this makes some sense.
is there a way to make views a different resolution from the window and not have it resize like shit? I want the view to be half the size of the window so all the pixels will essentially be a 2x2 square in the window, but this makes cracks in the tiles and just really shitty resizing all around
[QUOTE=Venezuelan;44171520]is there a way to make views a different resolution from the window and not have it resize like shit? I want the view to be half the size of the window so all the pixels will essentially be a 2x2 square in the window, but this makes cracks in the tiles and just really shitty resizing all around[/QUOTE] This is because other things gamemaker does not do, it does not know how to use dxcalls. To fix this, turn the viewing pallete into a surface. There is reason why this happens. When gamemaker uses dxcall for object, it is calling double rounding, causes 1 px offset. this is for deault frame only There are other issues too, such as DX permanent window size, no console reset. It leaves a very ugly margin that cannot be drawn on or removed. Yay gamemaker. [editline]8th March 2014[/editline] Here I will give code. [CODE]screen_x = 0; screen_y = 0; screen_w = //yoam; screen_h = //yoam; screen_scale = room_width/screen_w; screen = surface_create(screen_w,screen_h); if screen = -1 { instance_destroy(); }[/CODE] ^initialize [CODE]surface_reset_target(); draw_clear(0); draw_set_blend_mode_ext(bm_one, bm_zero); draw_surface_stretched(screen,screen_x,screen_y,screen_w*screen_scale,screen_h*screen_scale); draw_set_blend_mode(bm_normal); screen_refresh(); //iteratepuonext surface_set_target(screen);[/CODE] ^call every frame, update screen This is what it looks before: [IMG]http://i.imgur.com/Qptmu4M.png[/IMG] And then fix: [IMG]http://i.imgur.com/ofF8v85.png[/IMG]
screen_refresh() doesn't seem to work with Studio, telling me unknown function yeah all the screen_ functions and variables don't work
There are worse issues in GM:S regarding rendering, like: [IMG]http://i.imgur.com/ha8XtyM.png[/IMG] (transparent images) [img]http://imgur.com/TPadGdK.png[/img] (non-transparent images) [img]http://imgur.com/Xbn8xfW.png[/img] (sheet) Oh, and thats a known bug for quite a while now, regarding issues with [I]draw_sprite_part_ext[/I].
[QUOTE=Venezuelan;44174011]screen_refresh() doesn't seem to work with Studio, telling me unknown function yeah all the screen_ functions and variables don't work[/QUOTE] aff yyg have shot self in foot integrated mapping my foot. I am very sorry, I am not knowing how to help you. [editline]8th March 2014[/editline] [QUOTE=JohnnyOnFlame;44174483]There are worse issues in GM:S regarding rendering, like: [IMG]http://i.imgur.com/ha8XtyM.png[/IMG] (transparent images) [img]http://imgur.com/TPadGdK.png[/img] (non-transparent images) [img]http://imgur.com/Xbn8xfW.png[/img] (sheet) Oh, and thats a known bug for quite a while now, regarding issues with [I]draw_sprite_part_ext[/I].[/QUOTE] this is your fault, gamemaker will draw textures by call of type. You have selected wrong pane, not drawing full plane, fills transparency.
GameMaker: Studio now natively supports PlayStation 4. [URL]http://blog.eu.playstation.com/2014/03/19/gdc-new-tools-middleware-coming-ps4/[/URL] [url]http://yoyogames.com/news/210[/url]
I'm trying to make a walking animation, and the code is set correctly, I've got subimages, why won't it work? [QUOTE]if x>xprevious then {image_speed = 4; sprite_index = spr_playerR if x<xprevious then {image_speed = 4; sprite_index = spr_playerL if x=xprevious then {image_speed = 0; image_index = 0[/QUOTE]
x/yprevious are a bit buggy, they only work if you're using the inbuilt speed. That could be it. Also, any image speed>1 means you've got too many frames in your animation.
I've been working on a piece of middleware for a super secret larger project also in GM. The point of it is to convert a 3D grid to 2D sprites but I won't go into more specific details. Anyway I've kind of got custom directional lighting working, which was somewhat of a pain in the ass due to game maker lacking structures in the same sense as other languages and no 3D dot product function (at least in GM6.1?), but there's a problem with it where certain parts of the lighter areas are black. If anyone has ideas on how to fix it, please contact me in some way. If necessary I'd share code at that point. [T]https://www.dropbox.com/s/exc2fil8twpam1a/ae1.png[/T] [T]https://www.dropbox.com/s/ciu24o1gi9lrk61/ae2.png[/T] I've never actually finished a project in game maker but I have a load of prototypes and concepts (although most are really old unpolished stuff that are glorified Flash games), if anyone's interested in seeing them give me a positive rating of some sort. edit: god damnit why aren't my images thumbing?
You have to put your pictures in your public folder then right click it and hit "copy public link"
Hey can someone help me? [img]https://dl.dropboxusercontent.com/u/36159879/Halp.gif[/img] I have no clue how to make it so my gun stays at the front of my heli. I think it has to do something with lengthdir but I can't figure it out.
[QUOTE=Vilusia;44623757]Hey can someone help me? I have no clue how to make it so my gun stays at the front of my heli. I think it has to do something with lengthdir but I can't figure it out.[/QUOTE] if you give some implementation details I can help you. Are your left/right spirtes done with image_index or with image_xscale?
Image index I think. I did the flip in D&D and just used the change sprite and flipped it horizontally and then unflipped it when the other key is pressed.
Ok, then in your step event, try this: [CODE] if (image_index == <left>) //Replace <left> with the image index of your left sprite, if it's more than 1 image add "|| image_index == <left2>" and so on { gun_x = x-10; //Change -10 for how far from the sprite centre you want the gun } else if (image_index == <right>) { gun_x = x+10; } [/CODE]
[QUOTE=billi999;44627171]Ok, then in your step event, try this: [CODE] if (image_index == <left>) //Replace <left> with the image index of your left sprite, if it's more than 1 image add "|| image_index == <left2>" and so on { gun_x = x-10; //Change -10 for how far from the sprite centre you want the gun } else if (image_index == <right>) { gun_x = x+10; } [/CODE][/QUOTE] Hmmm that's not working.
[QUOTE=Vilusia;44627351]Hmmm that's not working.[/QUOTE] Is the gun a separate object?
[QUOTE=billi999;44627390]Is the gun a separate object?[/QUOTE] Yup [CODE]image_angle = point_direction(x,y,mouse_x,mouse_y) x=player.x+15 y=player.y+20[/CODE] This is in the step event for the gun.
[QUOTE=Vilusia;44627396]Yup [CODE]image_angle = point_direction(x,y,mouse_x,mouse_y) x=player.x+15 y=player.y+20[/CODE] This is in the step event for the gun.[/QUOTE] In the same event try this: [CODE] if (instance_exists(player) { if (player.image_index == <left>) { x = player.x-15; } else if (player.image_index == <right>) { x = player.x+15; } y = player.y+20; image_angle = point_direction(x,y,mouse_x,mouse_y); }[/CODE] That should be more error-proof now.
Sorry, you need to Log In to post a reply to this thread.