Snake Game + Question about percent chance

03/06/2015 19:15 elmarcia#1
Hi, i made this code for "the snake game" with autoit and was thinking about adding some buff/debuffs to the game so it can be challenging...


The thing is that don't know how to make it work ->

For example lets say we have, but i don't want to be all 25% each

Buffs:
-Invulnerable -> 15%
-Speed Down -> 30%
-U can eat Yourself ->15%
-Change Color -> 40%

Debuffs:
-Crazy snake (switch between controls) -> 15%
-Speed Up -> 20%
-Invisible Tail -> 20%
-Doubles your size -> 15%

How can i make it work that way with autoit (?
I don't want someone to share a code and thats it, a good example or explanation will be good.
Finally i want to know if the drawing functions are okay that way or i'm overdrawing all the time wasting cpu usage...

Here is the code if anyone wants to have fun for a while :d


Need files:
[Only registered and activated users can see links. Click Here To Register...]
Optional -> [Only registered and activated users can see links. Click Here To Register...]

I know the code looks bad, very sorry about that :c
03/06/2015 21:25 alpines#2
Just think about what you want to do and how to solve such problems. Write down the things the program should do (in order) and convert them to valid AutoIt-Code.
03/06/2015 23:31 elmarcia#3
Quote:
Originally Posted by alpines View Post
Just think about what you want to do and how to solve such problems. Write down the things the program should do (in order) and convert them to valid AutoIt-Code.
Hi!

I've been thinking for a while and came with the solution.

Here is what i get. A simple way of getting random buffs with different percent each other.