Jump to content


Photo

Blowing Bombs With mouse click


  • Please log in to reply
28 replies to this topic

#1 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 03:23 PM

Hi, im new here could anyone help me please?

I started a game and got some problems, i want to click the bomb and get highscore with delay and then restart the game. Here is Info box!
Information about object: obj_bomb_lvl2_1

Sprite: spr_bomb
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
start moving in directions 000001000 with speed set to 5

Alarm Event for alarm 1:
show the highscore table
    background: <undefined>
     show the border
     new color: 255, other color: 0
     Font: "Times New Roman",10,0,0,0,0,0

Collision Event with object obj_wall:
bounce not precisely against solid objects

Mouse Event for Left Pressed:
set the sprite to spr_bomb with subimage 0 and speed 1
change the instance into object obj_explosion, not performing events
for all obj_bomb: set Alarm 1 to 15


:GM023: | :GM002:

:GM040: | :GM078:

:GM127: | :GM016:

:GM129: | :GM108: :GM025: :GM040:

Edited by DevilSir, 27 February 2012 - 04:01 PM.

  • 0

#2 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 03:28 PM

Is this the information or did you actually add this into the 'execute code'?
  • 0

#3 Zealot644

Zealot644

    GMC Member

  • New Member
  • 266 posts
  • Version:GM8

Posted 27 February 2012 - 03:40 PM

OP, it sounds like you are doing the fruit tutorial...

Go back a few steps and follow it closely. It's pretty hard to mess up on.
  • 0

#4 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 03:51 PM

Is this the information or did you actually add this into the 'execute code'?

this is the info box
  • 0

#5 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 03:54 PM

OP, it sounds like you are doing the fruit tutorial...

Go back a few steps and follow it closely. It's pretty hard to mess up on.

yea its from fruit tutorial with my own version.
  • 0

#6 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 03:56 PM

So what is actually the problem?
  • 0

#7 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 03:57 PM

So what is actually the problem?

i click the bomb and i didnt get highscore
  • 0

#8 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 04:09 PM

:GM129: Left click event for bomb:

:GM108: sprite_index
:GM025: obj_explosion
:GM041: sleep for 500 - this is equivalent to half a second
:GM078: show highscore table - i think you should add a background, just to be sure that is not the problem
:GM047: restart the game
  • 1

#9 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 04:14 PM

:GM129: Left click event for bomb:

:GM108: sprite_index
:GM025: obj_explosion
:GM041: sleep for 500 - this is equivalent to half a second
:GM078: show highscore table - i think you should add a background, just to be sure that is not the problem
:GM047: restart the game

yea its working but i want to see the animated explosion first and then the score :/ now its like "click-BOO-Highscore" its cut the animation of bomb

Edited by DevilSir, 27 February 2012 - 04:15 PM.

  • 0

#10 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 04:18 PM

Then put 'sleep for 500', 'show highscore' and 'restart the game' into the obj_explosion Create Event

Edit:
sorry, put it in the Animation End Event

Edited by Jlm07, 27 February 2012 - 04:20 PM.

  • 1

#11 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 04:22 PM

Then put 'sleep for 500', 'show highscore' and 'restart the game' into the obj_explosion Create Event

Edit:
sorry, put it in the Animation End Event

LOOOOOOOL worked! a bit bugged though but worked

Edited by DevilSir, 27 February 2012 - 04:24 PM.

  • 0

#12 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 04:27 PM

Thaaaaaaaaaaaaaaaaanks a lot jlm07!!!! you are the best !!! :turned: !! can i ask you something els :unsure:

Edited by DevilSir, 27 February 2012 - 04:28 PM.

  • 0

#13 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 04:28 PM

Glad I could help. I you want the highscore table to show immediately after the explosion, you can take out the 'sleep for 500' action

EDIT:

Thaaaaaaaaaaaaaaaaanks a lot jlm07!!!! you are the best !!! !! can i ask you something els

OK, what is it?

Edited by Jlm07, 27 February 2012 - 04:34 PM.

  • 1

#14 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 04:40 PM

I use in game custom cursor and when times up in game i set :GM044: times up - ok.. at this point my cursor is default :/ so it going default when i have to press "ok" button and then its custom again

Edited by DevilSir, 27 February 2012 - 04:45 PM.

  • 0

#15 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 04:48 PM

Isn't that normal?

Edited by Jlm07, 27 February 2012 - 04:54 PM.

  • 1

#16 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 04:57 PM

dunno :) if is that normal then ok
  • 0

#17 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 05:00 PM

how about if i want to add fog of war at mouse? is that possible?
  • 0

#18 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 05:24 PM

Yeah it's normal. Unless you create your own button
e.g. here is a very simple one:

To use this, create a new object and just paste this on the required events

Draw Event
//create a button sprite [ OK ]
draw_rectangle_color(x-48,y-50,x+48,y+10,c_ltgray,c_ltgray,c_gray,c_gray,0);
draw_sprite(button sprite,sprite_index,x,y);
/* you have to change 'button sprite' to the actual button's sprite, you can make it an animation to make it more attractive*/
/*this is used to draw a rectangle the given colour (light grey and grey) using the draw event causes the button's sprite to be overwritten so you have to draw it again*/ 

Left press event:
highscore_show(numb);
game_restart();
//you can change this to whatever action you want 
//highscore_show(numb) = show the highscore, numb means you can add new highscore if met the required condition 
// game_restart() = restart the game, duh. 

EDIT:
what's 'fog of war'?

Edited by Jlm07, 27 February 2012 - 05:26 PM.

  • 1

#19 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 05:51 PM

___________________________________________
ERROR in
action number 1
of Mouse Event for Left Pressed
for object obj_own_button:

Error in code at line 1:
highscore_show(numb);
^
at position 16: Unknown variable numb
___________________________________________

Edited by DevilSir, 27 February 2012 - 05:52 PM.

  • 0

#20 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 06:01 PM

what's 'fog of war'?
__________________


Something like this
Posted Image


Edited by DevilSir, 27 February 2012 - 06:08 PM.

  • 0

#21 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 27 February 2012 - 07:53 PM

Oops! I think I got it mixed up, your supposed to change numb into how long you want your list to be. For example: if you want the top 10 names to be displayed type '10' instead of numb

Almost forgot about the word 'Time's out' in box
Use this code in the Draw event
//same: this draw the color rectangle
draw_rectangle_color(x-48,y-50,x+48,y+10,c_ltgray,c_ltgray,
c_gray,c_gray,0);

//same: this draws the button
draw_sprite(button sprite,sprite_index,x,y);

//new: this is the outline. Notice the '1' at the last argument? That's to indicate that it an outline.
//for a filled rectangle type '0' instead
draw_rectangle_color?(x-49,y-51,x+49,y+11,c_black,c_black,c_black,c_black,1);

//new: first line is the font, second line is for the colour, and finally the text which is very useful
draw_set_font(yourfont)
draw_set_color(c_black)
draw_text(x-24,y-25,"Times's Out!");
//you can change the color to a new one, also you have to add your font for he time out message. 
//You can change the 'x' and 'y' in the draw_text to your preferance
//Plus I added an outline cause I thought it looks plain without one
//you can erase all these comments because they are the ones taking all the space. :P

For the fog of war... um... I have no idea!
I have to experiment to figure this one out.

Edited by Jlm07, 27 February 2012 - 07:56 PM.

  • 1

#22 Zealot644

Zealot644

    GMC Member

  • New Member
  • 266 posts
  • Version:GM8

Posted 27 February 2012 - 08:13 PM

For the fog of war... um... I have no idea!
I have to experiment to figure this one out.


For fog of war, I'd assume you could create a 'fog of war' object that is removed when a collision occurs?

A better explanation of fog of war is basically it serves as an area of 'unknown' to the player. When you move something such as a unit (typical in RTS games) towards the fog of war, it begins to remove a portion of it in the path that the unit is going, thus revealing what was previously unknown.

Edited by Zealot644, 27 February 2012 - 08:14 PM.

  • 0

#23 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 08:16 PM

Thanks for everything :thumbsup:

Edited by DevilSir, 27 February 2012 - 08:18 PM.

  • 0

#24 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 09:25 PM

Oops!


But how to do it ? my timer is like this:



Information about object: obj_timer_score

Sprite: <no sprite>
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: <same as sprite>

Create Event:
set variable time to 5
set Alarm 0 to 30

Alarm Event for alarm 0:
set variable time relative to -1
if time is smaller than 0
      display message: Times Up!!!
      show the highscore table
    background: background5
     show the border
     new color: 16777215, other color: 16777215
     Font: Terminal,14,0,1,0,0,0
      go to room level1 with transition effect Blend
else
      set Alarm 0 to 30

Draw Event:
      at position (343,0) draw the value of: time
      at position (272,0) draw text: Time Left:
      set the drawing color to 4900848
      set the font for drawing text to fnt_1_score and align left

i think its messed up coz i got score+timer at same obj :wacko:
  • 0

#25 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 09:27 PM

:GM023: | :GM073: :GM040:

:GM125: | :GM063: :GM073: :GM072: :GM078: :GM044: :GM040: :GM064: :GM066: :GM037:

:GM131: | :GM074:

Edited by DevilSir, 27 February 2012 - 09:27 PM.

  • 0

#26 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 27 February 2012 - 09:29 PM

:GM063: :GM120: :GM119: :GM110::GM066:
  • 0

#27 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 28 February 2012 - 05:20 AM

You got the arrangements mixed up

:GM040: | :GM072: :GM073: :GM063: :GM044: :GM078: :GM037: :GM066: :GM064: :GM063: :GM040: :GM066:
  • 1

#28 NukeTheCat

NukeTheCat

    Isaiah 11:6

  • GMC Member
  • 553 posts
  • Version:GM:Studio

Posted 28 February 2012 - 08:33 AM

Ok, here is the Fog of War script I created:

http://www.mediafire...u16vn885iccqdv6
  • 1

#29 DevilSir

DevilSir

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 28 February 2012 - 07:54 PM

Ok, here is the Fog of War script I created:

http://www.mediafire...u16vn885iccqdv6

Thaaaaaaaaaaaaaaaaaaaaaaaanks you are awesome!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :ohmy:
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users