123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|128|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Off Topic -> Sine of Ints

Page : 1 2 Next
Prev
Posted : Monday, 07 October 2019, 06:38
spinal
I don't suppose anyone here has every tried drawing a sine wave without floats (including PI)?

-=-=-
Check out my excellent homepage!
Posted : Monday, 07 October 2019, 06:38
Jayenkai
Probably best to use an array for that kind of thing, I think.

-=-=-
''Load, Next List!''
Posted : Monday, 07 October 2019, 07:47
spinal
Yeah, I was thinking something like that
Posted : Monday, 07 October 2019, 11:30
spinal
My brain has turned to mush.



I'm probably backwards in the maths, but the above code doesn't seem to give me the 50% scale (red) that I'm looking for....

-=-=-
Check out my excellent homepage!
Posted : Monday, 07 October 2019, 12:40
Jayenkai
What is it, exactly, that you're trying to do?

50% of the x or the y?

(If you could hand-draw what you'd like it to look like, I'll give it a whirl)

-=-=-
''Load, Next List!''
Posted : Monday, 07 October 2019, 12:54
Jayenkai
This .. might.. help. Depends on what exactly you need!



-=-=-
''Load, Next List!''
Posted : Monday, 07 October 2019, 14:23
spinal
Almost what I need!



Just needs to go backwards also

-=-=-
Check out my excellent homepage!
Posted : Monday, 07 October 2019, 14:43
Jayenkai
For backwards do x=(( lx-t)*180)/lx. (I think)
The added safeguard should be more than enough to cope with negative values.

-=-=-
''Load, Next List!''
Posted : Tuesday, 08 October 2019, 01:25
spinal
OK, that's part 1 done! Many thinks to Jay for that!

Not sure if its the best way to produce a hilly terrain, but it looks OK



-=-=-
Check out my excellent homepage!
Posted : Tuesday, 08 October 2019, 05:12
Jayenkai
Well, I'd never have thought it'd be that!!
I was expecting some kind of thumbstick recalibration, (to rescale values around a larger deadzone) or something!!

-=-=-
''Load, Next List!''
Posted : Tuesday, 08 October 2019, 11:52
spinal
Looks like I'll have to change language, making the above a bit of a waste of time.
The 'without floats' was because micro-python on the pokitto doesn't support floats. But I think the rest of the project will require plenty of angles and such, so a switch to C might be best.

-=-=-
Check out my excellent homepage!
Posted : Tuesday, 08 October 2019, 11:57
Jayenkai
It'd still be quicker using the lookup table.
Depending on how much maths you're doing, and ... I assume the Pokitto is low on cpu?.. might be worth keeping it around. (And maybe increasing the array to a full 360, for multi-purpose reuse)

-=-=-
''Load, Next List!''
Posted : Tuesday, 08 October 2019, 12:52
spinal
I was thinking something along the lines of linerider (pun not intended). I assume knowing your angle compared to the 'ground' and applying some sort of acceleration would need a bunch of trig.

-=-=-
Check out my excellent homepage!
Posted : Tuesday, 08 October 2019, 13:33
Jayenkai
Not necessarily.. you could guesstimate it reasonably well..

Take the next few values up ahead (say the next 8 or so pixels) and average them out, then either speed up or slow down depending on whether the average is above or below you..

-=-=-
''Load, Next List!''
Posted : Monday, 14 October 2019, 14:06
spinal
OK, started it up in java on pokitto. So far, I have plenty of hills and a small wheeled 'car' (that's a stretch, its a line with two wheels), currently I'm only using forward acceleration and gravity, like what I learned doing platformers and it looks OK. It's not 100% perfect, but its not bad.
Thing is, it doesn't really 'jump' off the hills... Not sure how to achieve that.



-=-=-
Check out my excellent homepage!
Posted : Monday, 14 October 2019, 15:01
Jayenkai
Looking great!!!

go for something like .. adding per frame the Y difference from the last few frames to the current one.. then if "not on the floor" make the last value the current "fall" speed (which should hopefully be upwards!)

-=-=-
''Load, Next List!''
Posted : Monday, 14 October 2019, 22:12
rockford
That looks pretty good to me
Posted : Tuesday, 15 October 2019, 03:38
spinal
Tried a different approach. Rather than adding global gravity to the wheels, I tried rotating each wheel around the other and the acceleration moving in the direction of the angle between the wheels...



Cute, but wrong

-=-=-
Check out my excellent homepage!
Posted : Tuesday, 15 October 2019, 04:04
Jayenkai
LOL!

Jelly Rider!!!
Posted : Tuesday, 15 October 2019, 09:56
steve_ancell
Most certainly getting there, good luck with this.
Posted : Wednesday, 16 October 2019, 02:49
spinal
Broke it. Ok time to start over.... Tomorrow 😆
Posted : Friday, 18 October 2019, 00:30
spinal
OK, attempted to pop the code into blitz for speed of testing etc. but for some reason this no work



That aint no smooth hillside

-=-=-
Check out my excellent homepage!
Posted : Friday, 18 October 2019, 05:10
Jayenkai
The line
da#=pi / hillWidth

Should be
da#=180.0 / hillWidth

(.. or at least, it works if you do that!! .. Might still be wrong!!)

-=-=-
''Load, Next List!''
Posted : Friday, 18 October 2019, 08:32
spinal
I wish they would pass laws about sin/cos using degrees or radians 😤

-=-=-
Check out my excellent homepage!
Posted : Friday, 18 October 2019, 09:01
Jayenkai
I typically make a sind() cosd() set of functions when I'm using rad-based languages.
My head works in sets of 45, like the angles on a joystick!!

-=-=-
''Load, Next List!''
Page : 1 2 Next
Prev