I need help with my little Game

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Kiliaan
Posts: 7
Joined: Mon Jan 09, 2017 6:50 pm

I need help with my little Game

Post by Kiliaan » Thu Jul 20, 2017 6:04 pm

Hey Livecoders!
I have a Problem :(
I need you to help me creating a small Game.

GAME EXPLAINED

I want to recreate a modified Version of hau the mole.
By clicking on a Button some Circles start changing there color from Black to red(also at the same or some small time differneces between them). In this time you have to click the square if not you automaticlly will lose.

MY IDEA THAT DIDNT WORK

The problem im dealing with is that i created a method for every single square that tells him to change his color. But when i press the button only one of my circleMethods starts(the first mentioned in the button script) and the others won't. So think that the Button Method waits until the first mentioned method stops, then it goes on to the second method.

WHAT I HOPE GETTING FROM YOUR ANSWERS

Just a solution for my Problem or a complete new Idea for creating that game.





I know my english is very bad but im improving(16 years old)!
Hope you can help me creating this game!
with warm regreeds from Germany!!!!!!
Last edited by Kiliaan on Fri Jul 21, 2017 1:34 pm, edited 1 time in total.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: I need help with my little Game

Post by bogs » Thu Jul 20, 2017 6:22 pm

I think there are a few ways that readily come to mind for changing multiple colors in a quick seeming way.

In the dictionary, check the entry "lockScreen". In essence, this puts the screen in a "hold" mode, while your code, probably in a loop, would change all the colors. Then you simply unlock the screen, and *poof*, your changes are displayed.

A second method that may work, again probably in a loop, would be using "without waiting". Since nothing is actually moving (if I understood your description correctly), the color changes would go off like firecrackers, real fast.

The loop might look something like this:

Code: Select all

on mouseUp
        repeat with x = 1 to the number of controls
            if the backgroundPattern of control x = "" then
                set the backgroundPattern of control x to "208007"
            else
                set the backgroundPattern of control x to "" 
            end if
        end repeat
end mouseUp
the pattern used for testing looks like this :
Image

Hope that helps you.
Image

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: I need help with my little Game

Post by dunbarx » Thu Jul 20, 2017 6:45 pm

Hi.

Make four buttons. In the script of the fourth button:

Code: Select all

on mouseUp
   set the backColor of btn 1 to "0,0,0"
   set the backColor of btn 2 to "0,0,0"
   set the backColor of btn 3 to "0,0,0"
   repeat with y = 1 to 255 step 3
      if the optionkey is down then exit to top
      repeat with u = 1 to 3
         set the backColor of btn u to y & ",0,0"
      end repeat
   end repeat
end mouseUp
Click the fourth button. If you press the optionKey, the color change will stop/

Craig Newman

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: I need help with my little Game

Post by jacque » Fri Jul 21, 2017 5:01 pm

A typical method is:

Lock the screen
Use a repeat loop to return all buttons to their default color
Get a random number and set the backColor of that button to the selected color
Unlock the screen

Locking the screen prevents updates, and this will run very quickly.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Kiliaan
Posts: 7
Joined: Mon Jan 09, 2017 6:50 pm

Re: I need help with my little Game

Post by Kiliaan » Sat Jul 22, 2017 9:08 pm

Thanks for all your Answers!!!
I love how kind the livecode Community is!
I will try all your Solving Ideas!
Thanks again. Have a nice Day.

Kilian :D

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: I need help with my little Game

Post by MaxV » Tue Jul 25, 2017 12:11 am

It's easy to do it with livecode, looks what I did for my wife:
Image

My problem is the artificial intelligence, I don't know how set difficulty level after level, my game becomes too fast after some levels.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Kiliaan
Posts: 7
Joined: Mon Jan 09, 2017 6:50 pm

Re: I need help with my little Game

Post by Kiliaan » Tue Jul 25, 2017 12:50 pm

Hi MaxV!
This looks like the thing i was looking for!
Can you send me the stack?
Would be cool if you can.

have a nice day Kilian

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: I need help with my little Game

Post by MaxV » Wed Jul 26, 2017 6:50 am

Here is the stack and files
Attachments
giocoTalpine.zip
(15.6 KiB) Downloaded 165 times
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Kiliaan
Posts: 7
Joined: Mon Jan 09, 2017 6:50 pm

Re: I need help with my little Game

Post by Kiliaan » Wed Jul 26, 2017 12:17 pm

Oh man i love you!
Thats exactly what i was looking for!
Thanks a lot!

:roll: :x :P :D

greetings from Germany

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”