Jump to content


Frankencost

Member Since 23 Apr 2012
Offline Last Active Jan 10 2013 10:00 PM

Topics I've Started

"If" with several "or" statements not working

26 December 2012 - 10:54 PM

Hi Guys,

Hope you all are doing great,

Quick question, how can I make an if statement with multiple options? The thing is that I have a variable in my game that is increased +1 after each game when a code is entered, I need to throw a message (obj_winner) every 20 games (I mean at game 20, game 40 and 60), I know that the best solution would be to reset the variable value to 0 every 20 games but the problem is that the game has a very special prize (obj_bigprize) when the game number 65 is reached so I cannot reset the variable till game number 65, this is my code but the object winner is being show after every game when player enters a code:

if obj_save.checking==2 && global.accumulated =20 || 40 || 60{

instance_create(227,-300,obj_winner);
global. accumulated +=1


}
else{

instance_create(227,-300,obj_invalidcode);


}
if obj_save.checking==2 && global.accumulated=65{

instance_create(227,-300,obj_bigprize);
global.acumulado=0


}
I値l really appreciate your advice pals.

Unable to keep variable value after game_restart

26 December 2012 - 12:07 AM

Hi guys,

Hope you all doing great,

I know this question has been asked many times in this forum and I followed some instructions I read but I知 still unable to make my code work, this is the issue:

I知 making a game with 2 rooms, in order to get to the second room (Level 2) you must complete the 1st room within 65 seconds, if you do not succeed then the game restarts. If you make it to the Level 2 you will have 45 seconds to finish it and if you fail the game restarts , if you finish the level 2 then you get a prize after entering a 5 digits code, this 5 digits code actually will work every 20 games (meaning that if you are player 20 or 40 or 60 you will get a prize), if you are not any of these players then the game will restart.

Now here comes my problem, I need to set a variable that can keep its value regardless if the game restarts, I have tried making an object persistent and setting a variable to global, but the value is changed to 1 as soon the game restarts, here is my code;
//On create event of the persistent object_save (this will hold the variable reflecting the number of games)
global.played=1;

// On the create event of an object created (obj_validatecode) after entering the code;

if global.played==20{

show_message("Ganaste!");


}
else{

instance_create(227,200,obj_invalidcode);


}
// On the create event of obj_validatecode;

global.played+=1
game_restart();


As you can see I need to keep the value of the variable  global.played but I so far I致e been unable to do so. I will really appreciate your help guys since after almost 8 hours dealing with it I知 giving up   :confused:/>/>

Game with keyboard - How to display vars values

17 December 2012 - 01:57 AM

Hi guys,

Hope you all are doing great; I知 having a really hard time trying to make a  small keyboard in a simple game, I have a set of 6 buttons and each is  representing a number (0 to 6), then I have a set of 6 buttons representing 6 letters (A to F),   I also have a space (most likely a text input) where I want to display the value of each button every time a it is pressed like if you were writing something. I guess I have to assign a variable value to each button and draw the value of the variables on mouse pressed , the thing is that I don稚 know how to do it exactly, I知 doing this but this is not working currently, on object  button 1 (obj_b1) that must have a value of 1 I put the following code:

//Create Event
b1=0;
//Mouse Event: Left Pressed
b1=1;
draw_text(120,360,b1);

This is not working and also I don稚 know how to make that the consecutive number or letter is displayed next to the previous one, you know like in a calculator or form text field. I will really appreciate your help guys, I知 still kind of inexperienced with GM so please receive my apologies if the question is quite vague.  Thanks and have a great day!   :thumbsup:

Sprite Animation on Soccer player kicking the ball

10 August 2012 - 02:48 AM

Hi guys,

I知 trying to make a soccer player to kick a ball , I have the animated sprite of the player but obviously I have to set the image speed to 0 to avoid the animation from start when game is loaded,  now I want to start the animation when the kick button is pressed and after the kick is made then set the image speed back to 0 till  the next kick ,  I tried putting a variable on the player and change the values when left pressed changing the image speed to 5 but it did not work, could you please give me some advice?

I saw some post here but I知 still a newbie so I did not understand quite well.

Thanks

Retrieve Scores from HTML5 for facebook publishing

10 August 2012 - 12:29 AM

Hi Guys,

Is there a way to retrieve score from a GM HTML5 game so the score can be shared on Facebook? I mean, if I make a game with GM HTML and want to publish results, high scores or similar using the Facebook API would it be possible with a GM game? I know I could need the help of a second programming languaje such PHP or JavaScript but I would like to know if this is something doable, probably playing with the score variable..

Thanks a lot for your help! :thumbsup: