tmntppn's Forum Posts

  • Glad to help.

  • This is what I think the easiest way:

    • add instance var to the boxes to indicate its position
    • pick boxes at position of your choice
    • pick random(boxes.pickedcount) nth box
    • destroy box

    Demo: https://www.dropbox.com/s/fmusqnu88io24il/boxes.capx?dl=1

    There another way that I was thinking without instance variable, but I think it will require significantly longer code (using array, sorting, etc).

    Note that in the way you are creating the boxes, the 4 corner boxes are actually double (2 boxes on top of each other), each belong to one side.

  • LOL, I'm sorry but your questions are at times looks more like a quiz.

    Does the boxes have any variable (like position)? How do you draw the boxes? Does the width and height pre-determined? Could you just pick boxes with X coordinate and select random(5)?

  • You could create a function to do that. Pass in the number entered by the user as a parameter, and then have the function pass back the string of numbers up to that value.

    How do you return multiple values (unless you're calling it multiple times then store each value)?

    EDIT: Ah nvm... String of numbers...

  • No idea what you mean... Convert into what? Loop 10 times?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use condition sprite > compare frame:

    if object > animation frame = 10 {
    	object > set animation to "jump" (play from beginning)
    }
    [/code:32gsqy4l]
    Or you can use: (depends on your animation frames)
    [code:32gsqy4l]
    if object > on animation "sprint" finished {
    	object > set animation to "jump" (play from beginning)
    }
    [/code:32gsqy4l]
    
    EDIT: Maybe like this:
    [code:32gsqy4l]
    on start of layout {
    	player.set animation to "idle"
    }
    
    on object player clicked {
    	player.set animation to "sprint" (play from beginning)
    
    if player.animation name == "sprint" AND player.animation frame == 10 {
    	player.set animation to "jump" (play from beginning)
    }
    
    OR
    
    player > on animation "sprint" finished {
    	object > set animation to "jump" (play from beginning)
    }
    [/code:32gsqy4l]
  • Like this: https://www.dropbox.com/s/8l97n86okvolr5c/cook.capx?dl=1?

    • Click the grey square to start cooking.
    • Once cooking is complete, a red box is spawned (the dish).
    • Remove the dish from the pan (drag the dish somewhere else).
    • When the pan is empty, click again to restart.
  • I mean that it might be better to use just 1 frame for the button sprite and multiple frames on the character (because you were considering making a button with multiple frame). Having multiple frame on either the character and buttons can sometimes makes it difficult to manage latter on. This of course depends on the overall design of your project. If you manage the frames well then it shouldn't be a problem too. Just an idea. But since you're using hue, then passing a value probably makes even more sense.

    Your game look interesting though. Cute monster...

  • Create 6 instances of the same sprite. Give instance variable to the sprite, containing a value or id to indicate which color it has. With this, you can call a function while passing the value from the variable as a parameter. You can also use an array to specify how many sprite you need.

    Example:

    arr_colors = [red, green, yellow, ...];
    on start of layout {
    	for each arr_colors.x element {
    		create object bt_sprite
    		set bt_sprite.value to arr_color[arr_color.curX]
    	}
    }
    on clicked bt_sprite {
    	call function set_color(bt_sprite.value)
    }
    on function call set_color(var clr) {
    	player set animation/frame to clr
    }[/code:18b2nmiy]
    
    I would recommend you set all the different colors into the main character's animation/frame instead of the buttons. This allow the button to be independent as it will only pass the value needed, so if in case you add more color, you'll only need to modify the main character (no need to add new frame to the button).
  • Ah ok. 2 chrome indeed. Glad you found it.

  • How about join those 8 sprites into a single container? This way, you can create 1 sprite and the rest will be created as well.

  • I never had that problem. Seems like you have 2 chrome.exe? If you open a URL from shortcut, does it open the correct chrome.exe?

  • drive.google.com/file/d/0Bx4FqA ... sp=sharing

    Type the link without the '...' please.

  • I'm not sure what are you trying to do too. Why do you want to repeat "on start of layout" trigger? These trigger usually placed in front of the other condition, example:

    on start of layout {
    	stop animation;
    }
    on object clicked {
    	start animation;
    	wait 4 seconds {
    		call function create_object();
    	}
    }[/code:16cjfw88]
    All those codes above inside the event sheet is repeated every tick by system default.
    
    You're asking about repeating several actions, but your illustration in the first post shows like you're repeating several condition.