Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: (GM 6.1) Creating objects at a click point ???  (Read 1660 times)

0 Members and 1 Guest are viewing this topic.
(GM 6.1) Creating objects at a click point ???
« on: August 15, 2006, 06:28:25 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 494
In Gamemaker version 6.1, how do you make a system where you click anywhere
(global.left or right button click) and an object (such as a spell object) is created where you
clicked?
Very confused... ???
Logged

Manly men don't sass. Manly men get in FIGHTS! Fist fights using manly fists!
  • JetDesigns

Ben

Re: (GM 6.1) Creating objects at a click point ?...
« Reply #1 on: August 15, 2006, 06:42:30 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 437
First you'd need a controller object (an object that is specifically used to run background code and doesn't have a sprite).
Then in the global left pressed event use something like:
Code: [Select]
instance_create(mouse_x, mouse_y, object);
Logged
Want a place to upload your sprites and games for FREE? Look no further than GameDevotion

Hikij

Re: (GM 6.1) Creating objects at a click point ?...
« Reply #2 on: August 16, 2006, 06:38:39 am »
You might want to limit the casting with variables and alarms, or else the game will be so easy.
Logged
Re: (GM 6.1) Creating objects at a click point ?...
« Reply #3 on: August 16, 2006, 11:34:49 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 494
You might want to limit the casting with variables and alarms, or else the game will be so easy.
Yeah, I know, Ben's code works but I'll have to find a way to limit with alarms. Wait, I have an Idea...
Logged

Manly men don't sass. Manly men get in FIGHTS! Fist fights using manly fists!
  • JetDesigns
Re: (GM 6.1) Creating objects at a click point ?...
« Reply #4 on: August 16, 2006, 11:47:58 am »
  • 笑い男
  • *
  • Reputation: +9/-0
  • Offline Offline
  • Gender: Male
  • Posts: 2124
have a variable say, clicked
make it =0 in create (clicked=0)
then, when you click to create an object
if cliked=0{
clicked=1
alarm[0]=30 (or whatever)}
then in alarm[0], make clicked=0
Logged

この世に悪があるとすれば、それは人の心だ
  • .hack//The World
Re: (GM 6.1) Creating objects at a click point ?...
« Reply #5 on: August 21, 2006, 02:50:01 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1902
if mouse_check_button_released(mb_left) {
instance_create(mouse_x, mouse_y, object);
}
or for right mouse button
if mouse_check_button_released(mb_right) {
instance_create(mouse_x, mouse_y, object);
}
Put that in the step event of your object, not the one your creating, the one already on the screen.
Logged


.TakaM was here.
Quote
so my friend stole a giant bag of ketchup out of the ketchup pumping things and brought it to our table and we took it in the bathroom and i smashed it over the sink and kicked it around the bathroom and smeared it everywhere and we all took turns kicking the ketchup out of it and when we were done it looked like an african village was murdered in the bathroom
XFD.
  • Awesome Land

brucem91

Re: (GM 6.1) Creating objects at a click point ?...
« Reply #6 on: August 23, 2006, 11:22:52 pm »
does this work http://host-a.net/getfile.php?usern=brucem91&file=mouseclick.gm6No credit required. Should be easily adaptable.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.04 seconds with 48 queries.