amishstripclub's Forum Posts

  • EDIT: I am having the most trouble with For loops. In Python I use them by defining a 'helper' parameter and using it to run through lists and dicts. I can't seem to do this Construct 2. EX:

    list = [1,2,3]

    for x in list:

        print "Hello"

    Hello

    Hello

    Hello

    Is there a way to use a for loop in this manner in Construct 2?

    Hi Community! I just plunged into Construct 2 and I'm trying to draw some kind of similarity to what I've been doing in Python recently. I've found dictionaries and a little bit of information on how to manipulate them but I can't see how to perform some of the things I did in python. Example code:

    mbeerlist = {}       

    Stout = Beer('Stout', 'Beer', 10, 95, 70, 40, 40)

    Porter = Beer('Porter', 'Beer', 10, 80, 50, 50, 30)

    IPA = Beer('IPA', 'Beer', 100, 30, 70, 90, 50)

    brew1 = Beer('unknown', 'unknown', 10, 50, 80, 30, 50)

    def rate_beer(brew, mbrewlist, amt, inv):

            global mbeerlist

            bestbeer = None

            bestrate = None

            for beer in mbeerlist:

                rate = 0

                

                rate -= abs( mbeerlist)<img src="smileys/smiley41.gif" border="0" align="middle" />['Color'] - brew.color )

                rate -= abs( mbeerlist)<img src="smileys/smiley41.gif" border="0" align="middle" />['Profile'] - brew.profile )

                rate -= abs( mbeerlist)<img src="smileys/smiley41.gif" border="0" align="middle" />['Bitterness'] - brew.bitterness )

                rate -= abs( mbeerlist)<img src="smileys/smiley41.gif" border="0" align="middle" />['Carbonation'] - brew.carbonation )

                if (rate > bestrate) or (rate == None):

                   bestrate = rate

                   bestbeer = beer

                   brew.type = mbeerlist)<img src="smileys/smiley41.gif" border="0" align="middle" />

            print 'Congratulations! You\'ve brewed a ' + str(bestbeer) + "!"

            print 'Your beer rating is: ' +str(100+int(bestrate)) + "% !"

            brew.name = raw_input('Pick a name for your brew! ')            

            Beer.beer_noprice(brew)

            print "It is now in your Beer Inventory!"

    In this, a loop compares a player made beer (a dictionary with 4 values used to define it) and compare it to a list of all the types of beers, eventually picking the beer type it was closest to. In a simplified example, it would conclude: Player beer is 30, Porter is 40, IPA is 50. Player made a Porter!

    So... Is something like this feasible in Construct 2? I've started it with dictionaries, then arrays, then sprites, but I just can't seem to get a feel for how to transition this idea to C2. BTW I love the program otherwise. It really appears to be indie game on easy mode. Thanks for any help in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads