• Game Maker - Discussion
    132 replies, posted
-snip- I'm a dunce, and I figured it out.
Can anyone guess what this is? [t]https://dl.dropboxusercontent.com/u/4112921/Survival.JPG[/t]
[QUOTE=Shirky;44014535]Can anyone guess what this is? [t]https://dl.dropboxusercontent.com/u/4112921/Survival.JPG[/t][/QUOTE] 2d suicide survival perhaps? Me and my friends played that a few times. Don't know how it would operate in 2d though.
[t]http://i.imgur.com/J9YPyuZ.png[/t] made this a while ago and continuing now. Only real problem is that my sprites suck and I cant draw :(
Wow, didn't even notice there was a game maker thread. There is some cool stuff here :D
[QUOTE=hobothehero;44015359]2d suicide survival perhaps? Me and my friends played that a few times. Don't know how it would operate in 2d though.[/QUOTE] It works that there are random shrubs placed about that will randomly run towards you and attack you. They taunt you, make the yalala sound and everything.
My mother recommend me Game Marker when I told her I wanted to make video games when I was 9... 4 years later, couple of my friends are making a game... [video=youtube;hpleoBhCEfk]http://www.youtube.com/watch?v=hpleoBhCEfk&feature=c4-overview&list=UU0i5CuMVqKjefRumvv2s8rw[/video] Thanks Mom...
[QUOTE=StarBot;44019059]My mother recommend me Game Marker when I told [B]him[/B] I wanted to make video games when I was 9... 4 years later, couple of my friends are making a game... Thanks Mom...[/QUOTE] Your mom is also your dad? :O
I just learned the hard way that you reeaaally have to be careful with while loops or else your game completely freezes up :v:
[QUOTE=Vilusia;44019161]Your mom is also your dad? :O[/QUOTE] When I was writing the post, I thinking about my father.... He he... Sorry about that. [editline]23rd February 2014[/editline] One of my friend (who is a CODchild) just reviewed GM [IMG]http://i.imgur.com/Ws6xAso.png[/IMG] ... [URL="http://steamcommunity.com/id/blazerblazerblazer"]Here's his Steam...[/URL]
Okay, maybe you guys can help me out here. This code causes me to move through blocks for whatever reason. [code] acc=0.5 //Acceleration hspeed+=acc*(keyboard_check(vk_right) - keyboard_check(vk_left)) vspeed+=acc*(keyboard_check(vk_down) - keyboard_check(vk_up)) speed*=0.9 //Decreases the speed [/code] My code: In [B]create:[/B] [code] ///Stuff vsp=0 hsp=0 grav=1; grounded=true [/code] In [B]step.[/B] [code] pLeft = keyboard_check_direct(ord("A")) ; pRight = keyboard_check_direct(ord("D")) ; pUp = keyboard_check_pressed(vk_space) ; //Hit points if pLeft { hsp = -3.5; image_xscale = -1; acc=0.5 friction=0.2 } if pRight { hsp = 3.5; image_xscale = 1; acc=0.5 friction=0.2 } //No input / both if (pLeft && pRight) or (!pLeft && !pRight) { hsp = 0; } if pUp { if (grounded) vsp = -10; } vsp += grav; //verticl Collision if place_meeting(x,y+vsp,obj_Floor) { while !place_meeting(x,y+1,obj_Floor) y += 1 ; vsp = 0 ; grounded = true ; } else { grounded = false } //horizontal collision if place_meeting(x+hsp,y,obj_Floor) { while !place_meeting(x+sign(hsp),y,obj_Floor) x += sign(hsp); hsp = 0 ; } //commit x += hsp ; y += vsp ; [/code] [code] ///Broken movement code if !place_free(x,y+1) then {//Check if the player is on the ground... if x>xprevious then {image_speed = .3 sprite_index = Run} if x<xprevious then {image_speed = .35 sprite_index = Run} if x=xprevious then {image_speed = .2 sprite_index = PlayerIdle} if y<yprevious then {image_speed = 1; sprite_index = Jump}} [/code]
[QUOTE=rovar;44022265]broken code[/QUOTE] The reason why you never use 'speed' is because its terribly buggy. [CODE]if x=xprevious then {image_speed = .2;sprite_index = PlayerIdle;xspeed==0;}[/CODE] Keep in mind gml's speed ac var interacts as a slider rather than a static, so you will needing to change STOP change STOP oiver, having for the changes. In some cases, its useful, but it is not in this case. I also say unless it helps with thought not use 'then'. [editline]23rd February 2014[/editline] Lastly, there is a way to get more control for event driving since all listeners can be default access bar EVENT_USER_0-12: in Class Properties: persistent = 1 In Draw Event: [CODE] if (persistent) { persistent==0; vsp=0 hsp=0 grav=1; grounded=true } else { pLeft = keyboard_check_direct(ord("A")) ; pRight = keyboard_check_direct(ord("D")) ; pUp = keyboard_check_pressed(vk_space) ; //Hit points if pLeft { hsp = -3.5; image_xscale = -1; acc=0.5 friction=0.2 } if pRight { hsp = 3.5; image_xscale = 1; acc=0.5 friction=0.2 } //No input / both if (pLeft && pRight) or (!pLeft && !pRight) { hsp = 0; } if pUp { if (grounded) vsp = -10; } vsp += grav; //verticl Collision if place_meeting(x,y+vsp,obj_Floor) { while !place_meeting(x,y+1,obj_Floor) y += 1 ; vsp = 0 ; grounded = true ; } else { grounded = false } //horizontal collision if place_meeting(x+hsp,y,obj_Floor) { while !place_meeting(x+sign(hsp),y,obj_Floor) x += sign(hsp); hsp = 0 ; } //commit x += hsp ; y += vsp ; ///Broken movement code if !place_free(x,y+1) then {//Check if the player is on the ground... if x>xprevious then {image_speed = .3 sprite_index = Run} if x<xprevious then {image_speed = .35 sprite_index = Run} if x=xprevious then {image_speed = .2 sprite_index = PlayerIdle} if y<yprevious then {image_speed = 1; sprite_index = Jump}} }[/CODE]
Start off with a simple project. If you have an issue google it. 95% of the time it will be on the game maker forums.
Published my first game today :D [url]https://play.google.com/store/apps/details?id=com.lightsout_games.Shity_birds[/url]
Here's one for anyone with a bit of experience. I'm playing around with a game at the moment, and want certain hud elements to change when certain conditions are met. ie: Player at game start has no weapons. No weapon icons in the HUD are active. Player picks up and equips a shotgun. Shotgun HUD icon is lit up, and has a border to show it's equipped. Player then picks up a Rifle. Rifle HUD icon is lit up and bordered, shotgun icons border is removed. What is the best way to handle this? At the moment I've got a few variables, for whether a weapon is PICKED-UP, and whether a weapon is EQUIPPED to control these hud elements. The HUD elements are controlled with simple IF statements. However, I feel there should be a much more efficient and less intensive way to achieve this. Would this be a case where WHILE statements would be better? Basically, I'm asking how YOU would have these HUD elements behave. Thanks
I would have probably made an inventory with an array - that would take care of the picked up weapons, you'd store their ID there (you could set up some constants so you work with weapon names and not just numbers) and then I'd have a variable which would store the number of the inventory slot that is currently equipped. When you have this set up, you just have to look through your inventory with a FOR loop and draw the icons using a SWITCH statement. A simple IF condition will check if you should draw a border around said icon This might be a bit too heavy for you, though... Especially if you've never worked with arrays or data structures, for loops and switch statements.
[QUOTE=Jebus;44051463]Here's one for anyone with a bit of experience. I'm playing around with a game at the moment, and want certain hud elements to change when certain conditions are met. ie: Player at game start has no weapons. No weapon icons in the HUD are active. Player picks up and equips a shotgun. Shotgun HUD icon is lit up, and has a border to show it's equipped. Player then picks up a Rifle. Rifle HUD icon is lit up and bordered, shotgun icons border is removed. What is the best way to handle this? At the moment I've got a few variables, for whether a weapon is PICKED-UP, and whether a weapon is EQUIPPED to control these hud elements. The HUD elements are controlled with simple IF statements. However, I feel there should be a much more efficient and less intensive way to achieve this. Would this be a case where WHILE statements would be better? Basically, I'm asking how YOU would have these HUD elements behave. Thanks[/QUOTE] Hello. This file contains tutorial for exactly what you ask. [url]http://www.mediafire.com/download/xgcka779fc44fs2/.gmk[/url]
[QUOTE=PeeterCZ;44054006]I would have probably made an inventory with an array - that would take care of the picked up weapons, you'd store their ID there (you could set up some constants so you work with weapon names and not just numbers) and then I'd have a variable which would store the number of the inventory slot that is currently equipped. When you have this set up, you just have to look through your inventory with a FOR loop and draw the icons using a SWITCH statement. A simple IF condition will check if you should draw a border around said icon This might be a bit too heavy for you, though... Especially if you've never worked with arrays or data structures, for loops and switch statements.[/QUOTE] Sounds good. Sounds much neater and more efficient than the method I was using. I'll give it a shot when I get the chance! Thanks
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.
I'm assuming the random() variable might be referring to an objects position on the x plane in a vertical shooter. If, for example, you want obj_enemy to appear at a random x position when it is created, you need to set the x variable to a random x value within the game window. So when the instance is CREATED (so, in the CREATE event) you want to set the x variable to random(room width). So, in create for obj_enemy (for example); set x to random(room_width) This would mean, when the object is created, it is set to a random x position within the confines of the room. You can exchange the (room_width) value with a number, like (800), or another variable, if your design calls for it.
[QUOTE=Jebus;44065642]I'm assuming the random() variable might be referring to an objects position on the x plane in a vertical shooter. If, for example, you want obj_enemy to appear at a random x position when it is created, you need to set the x variable to a random x value within the game window. So when the instance is CREATED (so, in the CREATE event) you want to set the x variable to random(room width). So, in create for obj_enemy (for example); set x to random(room_width) This would mean, when the object is created, it is set to a random x position within the confines of the room. You can exchange the (room_width) value with a number, like (800), or another variable, if your design calls for it.[/QUOTE] thanks man I appreciate it
I have a problem with enemys overlapping can someone help?
What is the problem exactly? You'll have to be more specific, and probably provide the code you're using, describe the unintended effect, and what you want to happen.
Makin houses yo. [t]http://i.imgur.com/SOeMcRK.png[/t]
[QUOTE=Vortexz0r;44017474][t]http://i.imgur.com/J9YPyuZ.png[/t] made this a while ago and continuing now. Only real problem is that my sprites suck and I cant draw :([/QUOTE] If that background is parralax then I already like it.
Here's one for you. Let's say I've got maybe 5 different powerups in my game. I'm currently using seperate objects which control their individual bonuses, plus a parent which controls collision, expiry, that sort of thing. What's an efficient and most importantly, easily expandable way I can apply the unique effect of each powerup? At first glance it would seem like I'd have to do a seperate collision event with each powerup, but that would defeat the purpose of having a parent object. Right now I have a 'contents' variable assigned to each child powerup object. For example, my 'health' powerup has 'contents' of hp + 1, which affects the hp variable stored in a 'stats' array within the player object. However, this means I have to use a new 'if' statement on the 'player> contact > powerup_parent' for each different powerup. This is the process I want to streamline. How would I go about using something like an array to set this out?
[QUOTE=Jebus;44076061]Here's one for you. Let's say I've got maybe 5 different powerups in my game. I'm currently using seperate objects which control their individual bonuses, plus a parent which controls collision, expiry, that sort of thing. What's an efficient and most importantly, easily expandable way I can apply the unique effect of each powerup? At first glance it would seem like I'd have to do a seperate collision event with each powerup, but that would defeat the purpose of having a parent object. Right now I have a 'contents' variable assigned to each child powerup object. For example, my 'health' powerup has 'contents' of hp + 1, which affects the hp variable stored in a 'stats' array within the player object. However, this means I have to use a new 'if' statement on the 'player> contact > powerup_parent' for each different powerup. This is the process I want to streamline. How would I go about using something like an array to set this out?[/QUOTE] If you are not using an entity controller, do so. On the start of room, retrieve the entity ID of an object named powerup. The controller will assign it a VALUE that will define: visual representation effect whatever else you want Then when player contacts generic powerup item, player will read set VALUE, and will respond appropriately. If you really want, you can make a parent powerup instead which then does everything else, but you will then need to determine WHICH object it is (as no work of casting gml). You do not need to use if statements, because caseswitch is exist. Here is an example. ENTCONTROL: [CODE] var ja; ja= instance_create(<def pos for x,y of powerup>,powerup); ja.type=<poweruptypenumber> [/CODE] POWERUP i PLAYERINTERACTION CODE: [CODE] switch (type) case type==n: <all drawing, all behavior, etc> break; ... [/CODE]
[QUOTE=Jebus;44066000]What is the problem exactly? You'll have to be more specific, and probably provide the code you're using, describe the unintended effect, and what you want to happen.[/QUOTE] [IMG]http://gyazo.com/f96fc9097ab7771c8b4aa2c038a37c6c.gif[/IMG] This problem that enemys stay behind the other enemy and move the same time. Also I dont know why there is this horizontal line in the background it wasnt there in GM8 only in the Studio version
[QUOTE=mn_chaos;44077674]If you are not using an entity controller, do so. On the start of room, retrieve the entity ID of an object named powerup. The controller will assign it a VALUE that will define: visual representation effect whatever else you want Then when player contacts generic powerup item, player will read set VALUE, and will respond appropriately. If you really want, you can make a parent powerup instead which then does everything else, but you will then need to determine WHICH object it is (as no work of casting gml). You do not need to use if statements, because caseswitch is exist. Here is an example. ENTCONTROL: [CODE] var ja; ja= instance_create(<def pos for x,y of powerup>,powerup); ja.type=<poweruptypenumber> [/CODE] POWERUP i PLAYERINTERACTION CODE: [CODE] switch (type) case type==n: <all drawing, all behavior, etc> break; ... [/CODE][/QUOTE] 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.
Best movement for pretty much anything: Create: [code] hspd=0 vspd=0 [/code] Step: [code] for(ix=0; ix<=abs(hspd); ix++){ if place_free(x+sign(ix),y) x+=sign(ix) else { hspd=0 break } } for(iy=0; iy<=abs(vspd); iy++){ if place_free(x,y+sign(iy)) y+=sign(iy) else { vspd=0 break } }[/code] Apologies for no indentation. EDIT: And if you want to add velocity in a direction use: hspd+=lengthdir_x(acceleration,dir) vspd+=lengthdir_y(acceleration,dir)
Sorry, you need to Log In to post a reply to this thread.