Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - hansbe

Pages: 1 ... 16 17 18
Old Bugs (1.x/2.x) / Re: Timer with 0.1 increment
« on: May 16, 2012, 04:05:42 pm »
Since I did a computer arithmetic lab today I thought I might 'geek' this one up a bit.   ;D

Double precision floating point should represent numbers to an acurracy of about 2^(-51.5).

For your 0.1 seconds that error would be about 30 attoseconds per iteration.

Linearly your error would build up to an accumulated error of 1 second over 100.91 million years running that code. The error build-up does however speed up abit, as the accuracy drops when the time counter value gets large compared to what you add to it. The error is anyway still small enough to neglect for almost all applications.

Two ways to handle it are:
 1. Keep the error and round off when presenting the number.
 2. Add 1 every time and divide by 10 before using the number (you'll still need to round off, though).

Choosing the amount of digits when converting a Number to a String doesn't seem to be supported in code blocks though. Although it's not a bug it would be a missing feature ..
In the meantime in the "anything as text" block you could probably write "_Time.toFixed(1)" when you use the number in a draw or print block. I then assume _Time is the internal representation of the number you want to present (it would be the default but to be sure the internal representation of attributes can be seen on the attribute tab) and 1 means to get 1 digit after the decimal point. i.e. 3.2999 will be converted to the string "3.3".

News / Re: Stencyl 2.1 - A Better Scene Designer (Try it Today)
« on: May 16, 2012, 03:20:08 am »
I have some feature requests:
 - Ability to flip actors horizontal | vertical, by menu command or key-stroke combination. (rotating by Nx90 degrees through key-stroke is also interesting if mirroring is tough to support)

 - Ability to flip/rotate tiles. (could be more work to do ?)

Here's a hack that seemed to fix it.

  • Create recycled actor
  • Hide sprite
  • Position and rotate
  • "do after 0.01 seconds" { show sprite for New Bullet }.

Anyway the "bug" seems to be that for the first frame the recycled actor seems to be ready to be drawn, although it's not. It needs some sort of update, or the first frame must be skipped.

This happens for me too. My (long) bullets point the wrong way for a frame after recycling, then rotate to whatever i set it to in the next instruction.

It doesnt happen for every actor though, so it might have to do with the "threading".

Ask a Question / Re: How to make collectibles stay collected?
« on: May 15, 2012, 06:54:53 am »
Here is how I did it.

The way to push a "collected actor" onto the list was then:

(getValueForScene("Collectible Manager", "_CollectedList") as Array).push(actor.ID);

The previous version couldnt be used with save/load game. Now it should be ok.

Pages: 1 ... 16 17 18