AllanR's Forum Posts

  • nettemple

    unless you can click faster than 60 times a second, the counter should have no problem keeping up. Usually the computer spends most of its time waiting for the user...

    I would have to see your code, but maybe it is not counting some - because it thinks they are double clicks, or some other event is blocking the count.

  • Societyisbabylon

    I have seen forum posts about this before and I know people have used various methods.

    The two easiest as far as I know are to use the ShadowLight object and give your walls the shadowCaster behavior. A more manual way is to have black sprites cover rooms until you enter the room.

    I a made a quick sample showing both methods. The area on the left uses ShadowLight, and the area on the right uses black sprites to block your view.

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

  • jogibaer5000

    the name doesn't change. if you used Create Object to make an instance of Enemy, then its name is still Enemy.

    if there are other instances of Enemy, then you have to be careful how you "pick" them, otherwise any actions you do may apply to all instances - not just the one you expected.

    you can use instance variables to distinguish between them, or their UID, or Enemy(0).x or events such as Is Overlapping...

    in your example, you could use the "Self" reference, so it would be:

    Object(0) Set X to self.x + 5

    Object(1) Set X to self.x + 2

    etc...

    without the self reference you could also say:

    Object(4) Set Y to Object(4).Y + 1

  • Hex777

    sure, if you want to lerp to imagepoint 1, just set the position of the follower to:

    	follower set position to (lerp(Self.X,Sprite.ImagePointX(1),dt), lerp(Self.Y,Sprite.ImagePointY(1),dt))
    
  • Userame

    the easiest way to is pass the number into a function, then you can round it as you want, decide how many decimal places (if any) and then return the result...

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

  • Starconstructor

    in the properties for 8Direction, "Set Angle" to No

  • ok, just did a major update on the traintracks.capx

    I removed the code that was trying to manually space the wagons using an array of positions from the train head, and gave the wagons the bullet behavior instead. This works MUCH better - creating the train, starting, stopping are all greatly improved. And the CPU utilization is a lot lower as well - and simplified the code (they are all in the same family now).

    next thing I want to add is switches - so you can click to make the train change tracks! Another thing I would like to add is a control panel - click a train to bring up controls to start/stop/accelerate/slow down, zoom in/out to follow a train.

  • Gellowg

    you can also use remote preview if you just want to test it out for free.

    And you can export for HTML, upload it to a website, open it in Safari and save to Home screen. This works really well - and the price is right (free if you already have a web site).

  • Tenos

    I made a quick sample of how I would do it... put all the objects to find in a family to simplify the code.

    I made the spawn points big enough so that they can also be used when seeking. I have them at 20% opacity, but in the actual game you would want them to be invisible.

    each point has an instance variable to tell us if the location is occupied (which gets set when an object is put there.

    click the "Hide" button, and go find them!

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

  • Try Construct 3

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

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

    ok, since none of the instances actually move, and the routine recreates all segments row by row starting from the top left, you can't assume that the first instance is the head and the last instance is the tail.

    what it does is store the number of segments where the head just moved to, and then decreases every place in the array by one where there is a segment.

    so, the place in the array with the highest value (which is = Segments) is the head, and the place with a value of 1 is the tail.

    to get the direction for any segment, we would either have to look in the array all around that spot for a value that is one higher, in order to determine where the snake came from to get there. I thought an easier way was to create a second array and store the direction in a corresponding cell for that segment. So, the main array stores the segment number of the snake at that spot, and the direction array at that same spot holds the direction the snake was moving.

    The only irregular case is when the snake eats the food - all the segment values are bumped up by one, so when the snake is next created, there is no tail (segment with a value of 1). So, in that case we need to look for a value of 2 and we need to know the snake just ate food. Otherwise there would be no tail until the next time the snake gets recreated.

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

    oh, there was a bug - food could get created at the top of the screen where the snake could not get it. I fixed that by add 2 instead of 1 to the random number. I got a snake up to 171 segments! :)

  • Reneczech

    well, I had a lot of fun playing with that, and have a good start... I borrowed ideas from a bunch of places - a line following example ROJOhound made a couple years ago, smooth curves for trucks, a wiggly worm demo, etc.

    I made two track segments (straight, and a 90 degree curve) that can snap together to make the layout you wanted. It would be easy to make other types of track segments - just have the end line up, and create image points.

    if you turn on snap to grid with a grid size of 44x44 pixels it is real easy to place the tracks. You have to make sure to get the arrows on the segments all pointing the same direction - otherwise the waypoints wont get created in the proper order at runtime... the waypoints are created based on image points on the track segments. You also have to assign a sequence number to each section of track so the program knows what order to process them in, when the waypoints are created. (There is a family instance number called SegmentNumber for this).

    I changed the layout a little to make a loop so the trains can keep going around and around. Then I thought it should be possible to have multiple tracks... it uses the track name to know which track a waypoint belongs to.

    I also made it so that trains can accelerate and slow down and stop - but there are still problems with spacing the wagons. I used a method I helped someone else with (who was making a worm), it keeps a history of where the head has been to position the parts behind it. this works well for keeping the wagons on the tracks around corners. But, I am not sure it is the best way to do this... I might try some other options later this week.

    going around curves is not as smooth as I would like either... adding more image points to the tracks might help, but that might add other problems too.

    So, hopefully this will give you something to work with.

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

  • mumu64

    put the sprites in a family, and give the family the physics behavior. then, you can make the joint to the instance the player chooses.

  • well, just transpose as an intermediate step in the import process, so it ends up the right way in Construct.

    I wouldn't want to keep the data that way either!

    yeah, it is an extra step, but it would make life easier in C3.

  • Reneczech

    are you doing a top view or side view? and how long is the train? it would get a little tricky making all the cars getting pulled stay on the track, but I am sure it could be done.

    it would help if you posted a sample that had some track and parts of the train for us to experiment with.

  • I completely forgot about that check box - and I have used it to...

    I am also a database guy. I haven't used the C3 array editor, so I don't know how that works. I use PHP/MySQL and AJAX to load data from a database, and put the rows in X, and fields in Y, so a For Each X gives me rows.

    if the only option is to load in backwards in C3, you could transpose the data in Excel just before you load it, then it should look right...