AllanR's Recent Forum Activity

  • pcgun007

    you need to add a Drawing Canvas object, then paste the text object into it...

  • Vinzc

    you are probably loading the images into different instances of the same sprite object. All instances are just copies of the same original sprite, so they will all look the same - and show the last image loaded.

    you will need 4 different sprite objects. You can put them in a family, so the same code can be used - but each image has to go to a unique object.

  • RunningRazor

    I am not totally clear on what you are trying to do either... but I had to do something similar a while ago and this is how I did it...

    I do a lot with multi touch, so I like to create a "touchpoint" object to track the details about each touch (like where it started, how many ticks long the touch goes for, where it last was, how fast, etc.)

    this sample checks how fast and how far a touch goes for, and then sets the coasting speed and relative distance accordingly.

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

  • Dayvid86

    try this version I made that uses a sprite instead of a canvas...

    it also uses touch instead of mouse, so it will work on tablets and phones too.

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

  • Ninjadoodle

    nice job! after a dozen tries or so I was able to light all the houses - with a score of 43.

    And the sound turned off when I asked it! :)

    but I noticed when I launch the game a second time it didn't remember my best time... is that supposed to be saved in local storage?

  • divertap

    it should be down at the bottom, under the web section...

    if you don't see it there, then you have probably already added it! (I know I have done that a few times)

  • locohost

    for some reason I thought you could make a family into a container... that would have solved your problem. But since that isn't an option, you might want to put all your monsters in one sprite object - and make a separate animation for each different monster. that way you can make the combined monster object into a container to hold the arrays. Then set the animation for the monster you want, and set any instance variable as necessary, and each monster object will have its own arrays as well.

    It is still a good idea to have a family as well - that comes in handy if you have to compare two monsters at the same time (you pick one from the object and one from the family).

    but, I just did a quick test... when you pick a monster by the family, the container objects (arrays) are NOT picked. They will only be automatically picked when you pick the monster by the object.

    if you DO pick a monster by the family and need the arrays, you would have to pass the UID into a function where you then pick the object by the UID...

    see my sample here...

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

    you press a number key to create a monster (from 1 to 4 across the top of the keyboard - not on the number pad). Left click on a monster to pick it by the object to display his info. or right click to pick by the family... doing the right click didn't work properly until I made it call a function.

    EDIT. this method would be ok, if you don't have too many monsters, and the monsters don't each have numerous animations, and you typically use the same monsters on every layout - otherwise you might start to run into memory issues.

    an array can hold a lot of data! I don't really have a clear idea of just how much data you are trying to store for each monster. Rather than have a separate array for each monster, you might be able to have the monster's UID be the key to one large array. (an array can be three dimensional, so one array could hold a lot of data for a lot of monsters). Another option would be to just use instance variables - you can have a lot of those as well, and store a lot of data that way too...

  • I remember playing with the AirConsole plugin... it allows you to do that.

    the only other options would be to use the multiplayer plugin, or make your own websocket/node.js custom server... good luck with that!

  • locohost

    If you only have one instance of an array, you do not ever have to pick it.

    You can add multiple array objects and give them different names (just as you do with sprites), then when you refer to a particular name, you know which one you are working with. eg. playerArray.at(...) enemyArray.at(...) highscoreArray.at(...)

    you CAN use the System Create object to make additional instances of an array at run time... then you DO have to make sure you have the correct one picked. (You can give arrays instance variables which gives you addition ways tell instances apart).

    if you need to store an array of data for each instance of another object or family, you can make that object a container, and put an array object in the container. Then, when you create the object, the array gets created at the same time, and you will automatically have the correct array instance picked whenever the container object is picked. (and the array instance will be destroyed when the container object is destroyed).

    You can have a function return multiple values by concatenating them together (using a delimiter), and then use TokenAt to reference the value you need later... but that doesn't help readability.

    I like to use a lot of instance variables on objects, pass the UID of the object (and any input values as additional parameters) to a function to have it set all the instance variables as required. Then outside the function you reference the instance variables. That works best for self documenting. Using arrays is less readable because you have to figure out what each element of the array is actually storing. Although I have used dictionary objects to help with that, but that makes the lines of code even longer. I have also defined local variables to use as constants just to make lines of code easier to read... eg:

    name=0

    health=1

    strength=2

    set text to array.at(currentplayer, name)

    Set array.at(currentplayer, health) to 5

    ...

    (the variable definitions help document what is in the array. I also add comments at the beginning of every function to say what to pass in to the function, what the function does, and what it returns. If there is an array involved I will also have a comment defining what the elements of the array are - if I don't have the constants).

    but like I said, I would choose instance variables over arrays unless you have a very large amount of data to store for each object. And normally, I will have the objects in a family and put the instance variables on the family.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Isaske

    I definitely like the way body wiggles in your original version. it is very bug like! and feels more alive. I also like the tapered body.

    I would stick with the bullet behavior... the advantage of using dt is that you get the same game play on all devices. If someone has a high-end monitor with a really high fps rate, your worm would zoom around way too fast without dt. (or on mobile with low fps it will go way too slow)

  • Isaske

    I took another look to see how I would do option 1 above... and it was easier than I first thought. I added a BodyWidth instance variable to the body segment so that we can compare the distance a segment is from the previous one, and if the distance is greater than the BodyWidth variable then we move up the array until we find a position that wont leave a gap.

    so download the file from the link above and give it a try! I couldn't make show a gap in the worm.

    another change I made was to move each body segment to the bottom as they were being created, so that the head is on top and the tail is on the bottom. I think it works and looks better that way. If you don't like it, just remove the "Move to bottom of layer" action in event 5.

    good luck with your game!

  • Shouwrex

    export for desktop NW.js

AllanR's avatar

AllanR

Member since 21 Nov, 2013

Twitter
AllanR has 23 followers

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies