Jump to content


Photo
- - - - -

Instance Creation Code


  • Please log in to reply
100 replies to this topic

#81 photocopier

photocopier

    GMC Member

  • New Member
  • 765 posts

Posted 09 July 2008 - 04:40 PM

I use this to make one object serve as multiple objects. No longer will you need to make a different object for each square on a map! For each part of a boss that is destructible! For collision only objects that have different sprites! ...the list goes on. :(

what every object? lots of coding :whistle:
  • 0

#82 Skeddles

Skeddles

    GMC Member

  • New Member
  • 172 posts

Posted 01 August 2008 - 07:12 PM

Very nicely written, and a very useful feature.
Great job, you rock.
  • 0

#83 T. Westendorp

T. Westendorp

    GMC Member

  • New Member
  • 1270 posts

Posted 16 November 2008 - 02:52 PM

WHOA, WHOA!!! That's alot of people not knowing about the creation codes.... Still I did, good work telling the others though :(



T
  • 0

#84 Very Melon

Very Melon

    GMC Member

  • New Member
  • 118 posts

Posted 16 November 2008 - 05:33 PM

Very good indeed!

~Very Melon
  • 0

#85 ev149

ev149

    NinetySix Design

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

Posted 29 November 2008 - 02:31 AM

Thanks! Never new this existed, now I don't have to create 20 million different objects with minor changes in each instance's code!
  • 0

#86 Klestiko

Klestiko

    GMC Member

  • New Member
  • 252 posts

Posted 12 March 2009 - 02:40 AM

Thanks! This is an extremely useful thing to know!

One of the main reasons im replying to this is to serve as a bump so others can learn this, its really quite useful..
  • 0

#87 Mazin Mark

Mazin Mark

    GMC Member

  • New Member
  • 86 posts

Posted 12 March 2009 - 11:52 PM

I discovered this like a year ago when I like accidentally pressed control and clicked and I was like wtf? I then discovered it and ive been using it ever since! it's very VERY handy so you don't have to make a gazillion different objects for each individual situation in your game. Good job on spreading the feature!
  • 0

#88 T. Westendorp

T. Westendorp

    GMC Member

  • New Member
  • 1270 posts

Posted 13 March 2009 - 06:43 AM

Well, I guess this is my second post in this topic and I still don't believe that people can't read, seriously, go to the room editor, press the Objects tab. And THEN read what is said completly down, just to the left of the room..



T
  • 0

#89 Kalex91

Kalex91

    GMC Member

  • New Member
  • 355 posts

Posted 16 March 2009 - 09:48 PM

So say i have a button and i use the code "selected = true" when you click on it.
how would i make an object like for example obj_kaa appear in the room at a position.
(the object has code in it so i can move it around with the arrow keys)

Please could someone PM me the answer if they know. Thank you

Edited by Kalex91, 16 March 2009 - 09:52 PM.

  • 0

#90 Wildroses

Wildroses

    GMC Member

  • New Member
  • 4 posts

Posted 29 July 2009 - 07:00 PM

Thread resurrection!

So I was wondering if it's possible to include creation code for an object that is made during the game. For instance say I want to build a structure (say a city or something) but I want it to be different from my other cities is there a way incorporate creation code on an instance_create? or do I need to make a bunch of different objects?
  • 0

#91 funlerz

funlerz

    GMC Member

  • New Member
  • 113 posts

Posted 29 July 2009 - 07:35 PM

I knew about this feature for awhile but never found a use for it, now after looking at this I can see how it can be very usefull, and now I know how to make a simple teleportation script, which will come in handy I'm sure!
  • 0

#92 lomke

lomke

    GMC Member

  • New Member
  • 270 posts

Posted 29 July 2009 - 07:55 PM

Woah! This can be very usefull! Thanks!
  • 0

#93 arikispencer

arikispencer

    GMC Member

  • New Member
  • 931 posts

Posted 21 September 2009 - 07:53 AM

man this tut is so usefull the number of times i've linked people in the novice and intermediate forum to this, to answer there problem is getting to be a high number
  • 0

#94 arikispencer

arikispencer

    GMC Member

  • New Member
  • 931 posts

Posted 26 March 2010 - 10:10 PM

still been linking many people to this, and i have used it in my own RPG game i've been working on
very very useful

thanks :P
  • 0

#95 T. Westendorp

T. Westendorp

    GMC Member

  • New Member
  • 1270 posts

Posted 02 April 2010 - 08:49 AM

Thread resurrection!

So I was wondering if it's possible to include creation code for an object that is made during the game. For instance say I want to build a structure (say a city or something) but I want it to be different from my other cities is there a way incorporate creation code on an instance_create? or do I need to make a bunch of different objects?


with(instance_create(blabla)) {
execute your codes here
}

  • 0

#96 The_Guilty_Gear

The_Guilty_Gear

    GMC Member

  • New Member
  • 35 posts

Posted 28 December 2010 - 01:23 PM

nvm

Edited by The_Guilty_Gear, 28 December 2010 - 01:33 PM.

  • 0

#97 kelvinROCKz

kelvinROCKz

    GMC Member

  • New Member
  • 31 posts
  • Version:GM8

Posted 19 December 2011 - 07:56 AM

thx for this tutorial
  • 0

#98 Eldin64

Eldin64

    GMC Member

  • GMC Member
  • 227 posts

Posted 28 January 2012 - 07:29 PM

This is really helpful.

But I was wondering, being new to GML and all, how do I make the teleportation code to a different room relative?

Instead of just going to room1, can I write a code that'll make it go to room2, then3? Something like, "room_goto(next_level)" or something similar?
  • 0

#99 Mack151

Mack151

    GMC Member

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

Posted 18 June 2012 - 07:38 AM

This is really helpful.

But I was wondering, being new to GML and all, how do I make the teleportation code to a different room relative?

Instead of just going to room1, can I write a code that'll make it go to room2, then3? Something like, "room_goto(next_level)" or something similar?

I'm guessing you may have already solved it by now, but one possibility is to store the beginning rooms of each level in a global array at the game's start and make another global variable that stores the current level. Then, in the instance create code:

teleport_room = global.level_firstroom[global.current_level + 1]

Also, a heads-up to everyone who uses variable_local_exists to set default values: as of GM Studio, the function is obsolete. As a workaround, I reccomend creating a script for each object using the ICC that defines the variables and call that before everything else in the ICC... or if that's too much of a hassle, just stick to GM 8.1 for the time being.
  • 0

#100 sathk93

sathk93

    GMC Member

  • New Member
  • 6 posts
  • Version:Unknown

Posted 26 June 2012 - 11:50 AM

Hi,
I am using gm studio
and needed that teleport technique


but when i open it i html
it does not collide with it and just passes through

and when i open it in windows c++ runner
The window just closes down after the player object collides with the teleporter object

I am sure i used the code correctly in the same manner as described :)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users