The Daily Click ::. Forums ::. Klik Coding Help ::. Changin number
 

Post Reply  Post Oekaki 
 

Posted By Message

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
7th September, 2009 at 12:28:58 -

I want a number, who is starting at lets say 5 or whatever.
And i want it to become 4, then 6, then 3,7,2,8,1,9,0

How would i do that, i mean whats the best way to do it.

 
Code me a sausage!

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
7th September, 2009 at 13:39:20 -

I don't know if it's the best way but you could have 3 numbers and a flag off some object:

Start of Frame: A = 5, B = 5

(something happens) A = A - 1
(something happens) B = B + 1
(something happens) toggle object flag 0

If flag 0 is off, then C = A
If flag 0 is on, then C = B

Repeat as desired. The number you want for your purpose is value C.

The "something happens" would be whatever you have in your code to increment the numbers.


Edited by Del Duio

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
7th September, 2009 at 14:09:59 -

yeah i thought of something like that myself, dunno why i didnt try it.
i think i hoped there is some math thingie so i can use only one event...


 
Code me a sausage!

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
7th September, 2009 at 14:13:57 -

Have two values/counters, one which holds the value you're after (value1) and one that holds the value you're adding/subtracting (value2).

+ Start of frame
- Set value1 to 5
- Set value2 to 1

+ Something happens
+ If value2 mod 2 = 0
+ Set value1 to value1 + value2
+ Set value2 to value2 + 1

+ Something happens
+ If value2 mod 2 != 0
+ Set value1 to value1 - value2
+ Set value2 to value2 + 1

I think that'd work - maybe..

Edited by Flava

 
This is a signature. Have this one on me.

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
7th September, 2009 at 14:14:23 -

You could have two counters - one holding the current value, and one holding the amount to add in order to get the next term. Then:

* Always (or whatever)
-> Set "Sub_Value" to "(Abs( Sub_Value ) + 1) * ( Sub_Value / Abs( Sub_Value )) * -1"
-> Subtract "Sub_Value" from "Current_Value"

I think that should work?

Edited by Sketchy

 
n/a

nim



Registered
  17/05/2002
Points
  7234
7th September, 2009 at 14:54:17 -

I believe there's an extension that will take a list of numbers and choose one at random that hasn't already been chosen. I think it's the Nifflas object.

 
//

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
7th September, 2009 at 15:29:24 -

Oh i already solved it, i did what del diuo said i mean a bit different but, i was gonna do that anyway.
but thanks...

 
Code me a sausage!
   

Post Reply



 



Advertisement

Worth A Click