Colludium's Recent Forum Activity

  • Try this for a bit of fun:

    capx

    I made it for a help request I put out for similar problems I was having with floating point variables. The bottom line, I suspect, is you can't be care-free when dealing with your variables...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've also found the audio playback inconsistent. Occasionally a trigger, which arguably should only fire once (like a collision) would fire a couple of times and cause me much frustration.

    I've had best success using sub-event 'Trigger Once While True' as LittleStain suggests, even though the parent event is a trigger and my understanding is that this should not be needed. That has seemed to work consistently well for me. I've also tried Audo Tag "whatever" NOT playing - however, because option 1 using trigger once seemed the best for me I have little experience with option 2...

  • Aha - in that case, you need the Timer Behavior .

  • There are many different ways you could do this and it's probably worth checking through the FAQ and doing a forum search to see how other people would solve this.

    For me, I would give my enemy a Boolean variable WalkingRight and put a couple of invisible obstacles on the layout where I want the enemy to change direction. I would give my obstacles each a Boolean variable as well, something like ChangeToWalkLeft - the obstacle on the right would then have this set to true and the one on the left set to false (this prevents double collisions giving you problems later).

    Then in the event sheet, the enemy controls would be:

    • if enemy.WalkingRight = true ; simulate platform press right
    • if enemy.WalkingRight = false ; simulate platform press left

    -> On enemy collision with obstacle

    ---> if obstacle.ChangeToWalkLeft = true ; enemy.WalkingRight = false

    ---> if obstacle.ChangeToWalkLeft = false ; enemy.WalkingRight = true

    I hope my text version of the events you need makes sense...

    Have a look through the FAQ as I said at the start, there are some great examples of how to do all sorts of things with C2. Enough to take up your whole weekend... <img src="smileys/smiley1.gif" border="0" align="middle">

  • Thanks AllanR for the help. Although I'm a novice at time stamps, it would appear that the plugin could enable me to provide even more advanced features on my app in future (so that duty hours could be tracked over a rolling 7 day period for example - something for the next but one update I think!). Just for interest, my solution to this data crunching: I've decided to convert the input values using a common denominator so that minutes and decimal (1/100th) hours can be converted to/from each other without the answers resulting in those pesky floats. It's quite simple now I think about it... <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I'm going to call this closed because I've had the help I needed to get things moving forward.

    RamPackWobble - thanks for the examples. It's going to take my slow brain a while to understand the maths behind test 1 but it works a treat.

    AllanR - I'm downloading the plugin now - thanks for the tip, it might just do the job.

  • RamPackWobble and AllanR,

    Thank you both for your advice. I particularly appreciate the capx examples. I'll have a look at them today and let you know if they work for me - although I think your first point was excellent because it gave me some clarity on the issue... I seem to have become wrapped up in trying to solve a technical challenge rather than finding a workable solution to my update problem. I don't have time to look at the examples at the moment (day job in the way of fun) but I think I'm going to try to convert my time to minutes and store that data - that way there'll not be any floating point nonsense!

  • Dear community,

    I'm hoping that someone out there might be able to help me solve a problem I've been battling for the past couple of days. I'm trying to update my app for android and ios (link to google play) but I've hit the limit of my understanding of how computers do maths... The app is not a game, it's a time calculator (ie it does base 60 maths for hours and minutes addition and subtraction) and I'm trying to update it to offer decimal hours as an input option. So now I want it to be able to add floating point variables and convert said fractions into hours and minutes (using simple code if possible!).

    Presently the data is stored in arrays for hours and minutes and I'm sure I could fudge the current event sheet to make it work - but the OCD parts of my brain want to make the new version look neat and tidy.

    The problem is that when using floating point variables, the 'int', 'abs', "%" and other mathematical system expressions aren't reliable for my needs. C2 seems to round variables depending on their context and I'm stuck. Is there a simple and reliable way to convert a number such that the whole number can be displayed in base 10 and the decimal fraction can be converted to base 60... a way that will also work with negative numbers?

    Let me elaborate. Subtracting int(N) from N doesn't always give the decimal fraction that remains - see this capx to demonstrate what I mean.

    Does this mean that I'm going to have to convert my data into text strings and then manipulate the string to get the answers I want, or can someone think of another way...? If I need to I will, but I'm hoping for an elegant solution...

    I've tried following this thread's advice but it doesn't work for me, especially regarding negative numbers:

    scirra.com/forum/format-to-2-decimal-places_topic57060.html

    Thanks for reading this far!

    I know, C2 is meant to build games... I couldn't help myself!

  • An alternative could be to use a global variable MouseButtonTimeDown:

    Condition:

    Mouse Button is down

    Trigger once while true

    Action:

    MouseButtonTimeDown = time

    Then have another condition checking for MouseButtonTimeDown > whatever cutoff time you want for subsequent actions.

  • Could you post a link to a capx example?

  • They are all object variables inside the Sprite object. So with the event system you could manage lots of different instances all using the same handful of events.

    Edit - glad you got it - I'm too slow at typing again!!

  • When I do this sort of thing I put the physics parameters into object variables. Then, when it's time to resume, I just put them back into the object's physics parameters. Something like this should work if I understood your question fully:

    <img src="https://dl.dropboxusercontent.com/u/184657779/C2_demos/physicsOnOffParametersSave.png" border="0" />

Colludium's avatar

Colludium

Member since 26 Aug, 2013

Twitter
Colludium has 11 followers

Connect with Colludium

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
  • x3
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies