AllanR's Forum Posts

  • komalrajsingh, Very nice job so far! Although it seems the problem still exists...

    I believe the problem occurs when the sprPlayerPosition is overlapping more than one ElevatedBox. If that is the case, it only works correctly if it happens to pick the taller box. But that isn't always the case.

    I changed the code so that it always picks the taller one (by doing a For Each loop by descending ZHeight and then exiting the loop after the first one). I also eliminated some unnecessary code. Like pinning, you are always setting the sprPlayer position anyway, so there really isn't a need to constantly pin it and unpin it. Also, on your "Else" blocks, you don't need to repeat the condition from above (unless you were doing it for readability). In the Jump block you were checking if the sprPlayer is falling, but it is always falling because it is never actually standing on solid ground.

    Using the Platform behavior was a creative way of adding a "jump" ability to your player. Someone yesterday in the forums was asking how to do that, and I like the way you did it!

    You can see my version at: rieperts.com/games/forum/Xekorn2.capx

  • I just tried it too... and agree with Jim15.

    The artwork is really nice! then menu system is great. You are off to a fantastic start!

    In addition to Jim's comments I would love to see the fish move a fin or something. Even a simple 2 frame animation would go a long way to sell the idea that they are swimming. They already look good, so a little animation would go a long way!

  • Colludium, Using the plugin to convert to a timestamp is pretty much the same idea as what RamPackWobble was suggesting because it returns a single integer, only it also incorporates the date (as well as seconds and milliseconds). Then you can subtract one timestamp from another one and calculate how many days, hours and minutes is between the two.

    Or, if you want to add 4.75 hours to a timestamp you would have to convert 4.75 hours into milliseconds, Round(4.75 * 60 * 60 * 1000) = 17100000, then add that to your starting timestamp.

    One thing to watch out for with the plugin is that date.day(timestamp) returns the day of week, not the day of month, use date.date(timestamp) to get the day of the month. This confused me at first, and obviously others if you read through the forum thread for the plugin.

    so, if you set a global variable "CurrentTime" = date.UnixTimestamp

    then ask it for date.day(CurrentTime) you would get 5 for Friday, while date.date(CurrentTime) would return 31 because today is the 31st of January.

    The rest work the way you would expect (Year, Month, Hours, Minutes, Seconds).

    To get a timestamp for a given date/time (for example 1:30 pm tomorrow) use: Date.Date2UnixTimestamp(2014,2,1,13,30,0,0)

  • Have you looked into using unix time stamps? I wrote a calendar app and used the rex_date plugin. You can then convert any date (and time) into a timestamp, and then add it or subtract from any other timestamp - down to millisecond accuracy.

  • - did you try out my wall-tracing example? It isn't physics based, but does use the platform behavior, which does have simplified physics - so you can control how strong gravity is, how fast they move, how far they can jump, etc...

    rieperts.com/games/forum/Wall-Tracing.capx

  • RamPackWobble - Thanks! I sure learned a lot doing it! The tutorial that I based it on sure had some serious bugs. I might turn my example into an updated tutorial...

  • Ok, I think I have it working pretty well... I started with sqiddster's Gravity tutorial: scirra.com/tutorials/273/how-to-make-a-gravity-based-platformer

    and expanded on that... Gravity Zones tell it which way gravity goes. If zones overlap it calculates the average angle of gravity. There are two types of gravity zones: Relative and non-relative. Relative ones send gravity to a single point, so they work around curved objects (there is a semi-circle and round variation). Non-Relative zones work along flat surfaces and send gravity in the angle of the zone (these zones have an arrow so you can tell which way it goes - you can rotate them to any angle you need).

    The pink bars are gravity reversers. When the player or wall hugger hit one their gravity changes 180 degrees.

    The wall huggers go in the initial direction they are told to until they hit a blue direction changer. If they hit a green jump box, they jump. Usually when they get to the opposite side of the jump they are upside down, and by the time they get turned around they are not on the jump box there (but sometimes they turn around too quick and then jump right back).

    The main problem is that collision boxes don't come in circles, so for the round objects I made the collision box as close to round as possible, but when players and wall huggers go over the corners of the collision box they briefly think they are in the air, and they can't jump if they don't think they are on the ground. So, there are many times the wall huggers will go right past the jump boxes (usually on the round object but I have seen it on flat parts a couple times too).

    It is also real easy for the wall huggers to get stuck - you have to be pretty careful how you line up the floors, and sometimes the gravity zones (the inside corner on the L shape was tricky).

    Over all, the code is fairly simple - C2 does almost all the work... it is only 24 events! And it seems to run pretty smoothly, although it is doing a lot of collision checks.

    One other slight issue - the rotating square moves, but the gravity zones around it don't, so that confuses the two wall huggers on it a little. If you want moving surfaces, you either have to have the gravity zones move with the surface, or set them up in a way that works (and doesn't interfere with other zones)...

    you can get the capx file at: rieperts.com/games/forum/Wall-Tracing.capx

  • how would it know when to "jump" to another object, rather then just go around the one it is on. In your last example, the red square is on top of the "L" shaped block. Would it circle around that forever after it got to it? Or jump back down and reverse its path? How would it know it can jump to the platform below it, and not all the way over to the circle? If it did jump down to the lower block, would it have to head back to the left, as opposed to continue to the right (and go around under that block) and how would it know not to just jump back to the L shapred block?

    (I am just trying to understand all the rules before I try to implement it.)

  • wow, I remember colour cycling! That takes me back too - On some systems that was the only way to simulate animation! I haven't though about that in decades!

  • Well, I am still pretty new around here - but I am amazed at how fast updates come out, and how quickly C2 is improving.

    Sure, there is room for improvement. And the entire industry is evolving at a mind boggling pace. But C2 is already more than good enough to make awesome games! If we aren't successful as developers. we have no one to blame but ourselves!

    That being said, I am really looking forward to some of those requests being added too... :)

  • Guizmus - Thanks! :) I spent more time on this than I should have too. It was nice having a good starting point to jump into!

    If Mark makes money on this I think he owes us some royalties :)

    - obviously, you would have to come up with your own artwork - this is just the first image I found on google...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi Mark! I was curious about what you were trying to do, so I took the file that Guizmus made and expanded on it...

    first, I added a pause resume feature, and show the song's current playbacktime. That makes it easier to get the exact time for the start of each line.

    Guizmus was keeping a manual timer, which worked fine until I added the pause. I changed the song_position variable to be the current line being played (rather than the position in seconds).

    I also added a picture, and made the lyrics scroll - rather than the line marker.

    when you drag and drop the lyrics it now calculates what line you set it to, and starts playing from there.

    I thought about making it change the picture at certain points too...

    There is a bug in my code - when the lyrics scroll up under the Pause/Resume button it thinks you are trying to drag and drop the lyrics if you try to click on the button. I am not sure if you can block the drag and drop behavior on certain parts of the screen or not...

    you can get my version at: rieperts.com/games/forum/songfollow.capx

  • Tips that I find useful:

    a .capx file is just a .zip file, you can open it with a program like winrar and extract the files.

    then you can edit the .caproj file with a text editor and change the <saved-with-version> line near the top to your version number (if the .capx file you downloaded is from a newer vesion of C2 than what you have installed). Obviously, the .capx file can't be using any new features not available in your version - but if you are just checking out a tutorial or someone's example this works great.

    maybe everyone but me knew this one:

    you can use the same event sheet for multiple layouts. My son made a game with half a dozen levels and was running into the free version event limit. We re-organized it so all the levels used just one event sheet (because player movement and interaction with objects was essentially the same from level to level). This gave him lots of free events to keep developing! (we have since bought licenses).

  • That sounds really interesting! I am new to Construct 2, and just getting established. So, I would be more likely wait until the cameras were in the hands of consumers. But it is exciting to see what is coming in the not too distant future!

    The ideal method for integrating this into Construct 2 games (and Apps) would be a plugin (like Mouse / Touch / Keyboard / etc.)

  • well, you were close...

    rieperts.com/games/forum/page-finger-swipe-2.capx