From game maker to Construct: some questions.

This forum is currently in read-only mode.
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hi,

    I came from game maker, so I have some questions in order to traslate my skills in Construct.

    How you traslate this?

    a) when a obj_a is create, it create a obj_b in obj_a.x and obj_a.y

    obj_a:
    	Create Event:
    		instance_create(x,y,obj_b)
    [/code:chdj1vjy]
    b) look if there are a obj_c at 40 X pixel from me, if yes, change variable in obj_c
    [code:chdj1vjy]
    obj=instance_position(x+40,y,obj_c)
    if obj != noone
     {
    with(obj) 
        {
         name = "Olaf"
         }
     }
    [/code:chdj1vjy]
    c) obj_a pick obj_b and compare private variable
    [code:chdj1vjy]
    obj_a
         create event:
                    color = choose("red","blue","green")
    	step event:
    		P_08 = instance_position(x,y-altezza,b_obj)
             if P_08 != noone
              {
    		if (P_08.color = color)
    			{
      			...
    			}	
              }
    [/code:chdj1vjy]
  • a)

    + System: Timer is Equal to 1000
    -> System: Create object Sprite on layer 1 at (400, 300)
    -> System: Create object Sprite2 on layer 1 at (Sprite.X, Sprite.Y)
    [/code:3napcu8k]
    Or if you will always be creating those two objects together, put both into a container so when one is created they will both be created.
    [code:3napcu8k]+ System: Timer is Equal to 1000
    -> System: Create object Sprite on layer 1 at (400, 300)
    -> Sprite2: Set position to object Sprite (image point 0)
    [/code:3napcu8k]
    
    b)
    [code:3napcu8k]+ Sprite: overlaps Sprite2 : offset (40,0)
    -> Sprite2: Flash for 2 seconds with 0.1 seconds interval
    [/code:3napcu8k]
    
    c)
    [code:3napcu8k]+ Sprite: Value 'color' Equal to Sprite2.Value('color')
    -> Sprite: Flash for 2 seconds with 0.1 seconds interval
    -> Sprite2: Flash for 2 seconds with 0.1 seconds interval
    [/code:3napcu8k]
    
    Hope that helps
  • Note about containers: When you destroy one object in a container, it destroys all objects in the container. They essentially come as packages.

  • Hope that helps

    Yes. Thank you!

    One more question:

    If in case B, there are not two Sprite different, but two instances of same Sprite, how to flash ONLY the one at +100X form the other?

    <img src="http://i39.tinypic.com/9krzit.png">

  • Change the event:

    Flashactivator overlaps flashingthing -> Flash flashingthing

    to this:

    flashingthing overlaps Flashactivator -> Flash flashingthing

    That should do the trick.

  • >

    >

    > Hope that helps

    >

    Yes. Thank you!

    One more question:

    If in case B, there are not two Sprite different, but two instances of same Sprite, how to flash ONLY the one at +100X form the other?

    <img src="http://i39.tinypic.com/9krzit.png">

    I cold think of a few ways, but here's one using the family picking trick:

    http://dl.dropbox.com/u/529356/TempPics/greenflash.cap

    v0.99.84

    The green sprites are in the Green family, which is then used to distinguish between instances of the same object. Any questions feel free to ask.

  • >

    > >

    > >

    > > Hope that helps

    > >

    > Yes. Thank you!

    >

    > One more question:

    >

    > If in case B, there are not two Sprite different, but two instances of same Sprite, how to flash ONLY the one at +100X form the other?

    >

    > <img src="http://i39.tinypic.com/9krzit.png">

    >

    I cold think of a few ways, but here's one using the family picking trick:

    http://dl.dropbox.com/u/529356/TempPics/greenflash.cap

    v0.99.84

    The green sprites are in the Green family, which is then used to distinguish between instances of the same object. Any questions feel free to ask.

    Thank you, it is perfect!

  • I cold think of a few ways, but here's one using the family picking trick:

    http://dl.dropbox.com/u/529356/TempPics/greenflash.cap

    v0.99.84

    The green sprites are in the Green family, which is then used to distinguish between instances of the same object. Any questions feel free to ask.

    It works, and this is somewhat unrelated, but if you change the target from the overlap from the green family to GreenSprite, the game crashes. Why is this? Families work here, but I don't know why they do.

    On a side note, this is the one thing I dislike most about Construct. I personally find the event system hard to use when you have many of the same object, such as in this instance. You used a family to solve this problem, but why did it work? If I needed to do this myself, I would have ended up doing it the way I told you above, and resulted in a crash. Next, I'd try all kinds of craziness with private variables and whatnot, but some things in Construct just don't seem intuitive to say the least.

    This coming from an old Gamemaker user, so needless to say, I'm used to each object working independently without having to work out which ones will be affected by the global event sheet. Construct is so much better in so many ways, but manipulating individual instances is hard for me to wrap my head around with the event system controlling everything.

  • On a side note, this is the one thing I dislike most about Construct. I personally find the event system hard to use when you have many of the same object, such as in this instance. You used a family to solve this problem, but why did it work? If I needed to do this myself, I would have ended up doing it the way I told you above, and resulted in a crash. Next, I'd try all kinds of craziness with private variables and whatnot, but some things in Construct just don't seem intuitive to say the least.

    This coming from an old Gamemaker user, so needless to say, I'm used to each object working independently without having to work out which ones will be affected by the global event sheet. Construct is so much better in so many ways, but manipulating individual instances is hard for me to wrap my head around with the event system controlling everything.

    I switched form GM in mid January so slightly a head of the curve from you.

    I found it hard to switch but see the power. And still find GM scripting easier, but can not do so many things in GM that I can do in Construct, so hang in there.

    Try this to understand Families:

    http://sourceforge.net/apps/mediawiki/c ... e=Families

    But also look at Containers:

    http://sourceforge.net/apps/mediawiki/c ... Containers

    They will make you sprite life easier

    The other important thing that will make you project much easier to handle is using event sheets and including them.

    Oh and start small and grow. You will learn faster that way.

  • It works, and this is somewhat unrelated, but if you change the target from the overlap from the green family to GreenSprite, the game crashes. Why is this? Families work here, but I don't know why they do.

    Families are a way to group objects together. When you do that, you can test conditions and perform actions on the group. The group is treated as a separate entity where picking is concerned.

    In this case, the family is a group of one. The sprite is the only object in there. But this means that we can now refer to the object in two different ways... by it's object-self, and by the group-self. So... now you can check if Sprite is overlapping Family without any conflict. It's just a trick to make instances of the same object interact, it's not really what Families were designed for.

    For more info on picking, and the Selected Object List, check out the wiki:

    http://sourceforge.net/apps/mediawiki/c ... ct_picking

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You guys sure are helpful!

    I was attracted by the open source aspect, and I already like it a lot more than GM. I just have to get used to a few things I suppose.

    Thanks guys :D

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)