AllanR's Forum Posts

  • a click will always select all the objects the click touches - whether they are visible or not.

    what I usually do is put all clickable sprites in a family, and then on a mouse click (or touch) Pick the top most member of the family:

    Touch - On touched SpriteFamily
    	SpriteFamily - Pick top instance -> (do what you want to the object)
    
  • You do not have permission to view this post

  • well, nothing more fun than taking a ROJOhound example and adding some flashy animation...

    I made it create a whole deck, shuffle the cards, and place them face down.

    click a face down card to deal it to your hand. The hand automatically sorts and fans out the cards based on how many are in the hand.

    to play a card, drag it out of your hand and it will fly up to the discard pile.

    when you run out of cards, click the Build New Deck button...

    https://www.rieperts.com/games/forum/ArrangeCards.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • wow, a BIG thanks to both of you! I have been working all week on adding a javascript function that can resize very large images without loosing too much detail. I was jumping through all kinds of hoops using binary data and AJAX. This cuts out a lot of steps. So thanks again.

    the sample code below adds the img to the document so that I could see that it actually made it to the script. In my project I will be passing it over to the resizing function which will be pasting it back to the Drawing Canvas... Another "quirt" of Construct 3 that held me up is that when you resize a Drawing Canvas you must wait until its "On resolution changed" trigger fires and then draw something (anything) into it to make the resize complete. My script kept complaining that the Drawing Canvas was the wrong size and would not load the the resized image.

  • I have been playing with your code and will post something later tonight if all goes well... I have a number of suggestions for you that should help a lot!

    you are off to a great start here, and with a little tweaking it will do what you want.

  • The art is beautiful! Good luck with your game.

  • doing proper multi-touch is a lot harder than people think!

    I have been developing a standard library of routines that I use all the time your years now, and handle all the strange edge-case nightmares that users seem to find.

    so, I stripped down a version for you to try out... I don't have an iPhone 10s to test this on, so if there is still a problem, it is a bug in the iOS version on that phone - because there is no way MY code could be wrong! (/sarcasm)

    I like to use a sprite object to tack each individual touch. I have seen plenty of awesome examples from people like dop2000 who manage multi-touch with ids (without all the extra overhead I add), but my code is optimised to handle every fringe case I have encountered, and makes adding buttons and function for those buttons to execute really easy. So, take a look, and try it out. I added lots of comments to explain what is going on, but there is a lot involved - so it may not always be clear what it is trying to do.

    https://www.rieperts.com/games/forum/MultiTouch.c3p

  • don't use the System pick by evaluate in this case - Use the SpriteName "is boolean instance variable set" and then invert the condition (by right clicking and choosing Invert).

  • You do not have permission to view this post

  • ok, the first event will still only look at one instance of Enemy.

    How many enemies do you plan on having? dozens, hundreds, thousands? You would have to have some other way of making each Ally look for the best target. You could do a for each Enemy loop under the for each Ally loop, but as the numbers get big that will make things slow - especially if it is happening every tick.

    the lower event disabled the for each Ally loop so it isn't properly picking an Ally

    could you share the sample project for me to look at?

  • I don't think it is overkill at all! I think it is an awesome example of how to randomize something like this. I haven't had a need to use Advanced Random, but have worked on procedurally generated environments before (using a noise plugin). Advanced Random makes this a lot easier.

    the really nice thing about Advanced Random is that you can set a seed to always get the same results - for testing purposes or to let player share their seed so friends can play the same map they got to compare how they did.

    You would also want to set Advanced Random to replace the system random function - click the check box in the Advanced Random properties box. (you can set a seed there, or set one at runtime)

  • your event 63 picks all the Ally_Troop that has line of sight to an enemy, but you should then do a for each Ally_Troop (like the event above to get them each to shoot rather than just an random instance the way it stands now, but that is not how I would approach this

    there are several problems with the events...

    event 62 will pick the nearest enemy and check if it has line of sight to it. if it doesn't, it wont look for other enemies that it does have line of sight to.

    having event 63 do all the line of sight work again is adding a lot of work for the device playing the game. it would be better to have event 62 pick an appropriate enemy and save that enemy in an instance variable of the Ally_Troop so it knows which enemy to fire at in event 63.

    you might want to have the Ally_Troop check for a new target less than every tick as well (depending on how many troops are in action - as I assume you are having the enemy doing basically the same thing somewhere else).

    you also might want to put both the Ally_Troop and Enemies in a family that has all the instance variables to handle targeting and firing so one block of code and efficiently do all the work. The instance variable can be different for Ally and enemy - like range, accuracy, ammo, strength, hitpoints, etc...

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post