Newbie Slot Machine Project

Hello programmers.

I’ve been looking at Codea on the App Store as I’d love to write games for myself and for the fun of it but I’m not a programmer. I have questions but please be honest

is Codea easy for a total non-programmer to use/learn?

Can you write quality games with it? Say for example could someone who knows codea, write a match 3 gems game as good as bejeweled or an rpg as good as the early 2d Zelda games or a endless runner as good as jetpack joyride?

For a non programmer, would it take weeks, months or years to learn?

Would you recommend a non programmer buy codea or would you say it’s best not to?

Thanks for your reply

Thank you, I have the code inserted and the correct image paths added, it seems to work fine but the test will be the next time I post my code here.

Been having fun and problems today, wanted to add a hold function, but of course touching the screen spins the reels so I had to modify the code and make a tempory start button and only spin the reels when that area is touched then I had to figure out how to get the hold working and display the hold/held buttons etc. I had quite a few problems changing my code but I guess fixing the problems you make is half the fun of it.

I amazingly (for me) have the hold working now on reel 1, so just need to duplicate the code for reels 2-3. I’m also toying with the idea of displaying 3 items on each reel, rather than one. Might not serve much purpose right now but would be needed when (if?) I get to code a nudge function!! I’m getting ahead of myself though.

Perhaps I should have started a blog for this project as I seem to be spamming the forum with my babble. Sorry, I’m just excited about codea and my game. :slight_smile:

For the first: Yes, provided you put in the effort and time.

Depends on how hard and long you try will decide how good you get
Again, If you aren’t going to put in the effort and time, I would say no,

else
print("Get it!")

I would say look thru some of the wiki tutorials and if you can understand the code, then buy Codea. If it doesn’t make any sense after you try, then don’t bother.

@CodeaNoob you forgot to close your statement

And I think it’s worth to buy it if, as said befor, you’re willing to learn it

As for the time, it could be that you’re one of the people who learn quickly, but either ways, everyone on here (almost everyone) still learns some tips and tricks sometimes, even if they are/used to be professional programmers

so for the time it takes to learn: it never ends, and that’s the fun of it :wink:

Jetpack Joyride and Zelda could potentially be made using Codea but it take a strong understanding of Codea and a lot of time

Codeanoob thanks for that

Dave1707 thank you for the idea, I think looking at any code right now it wouldn’t understand it because I’ve never coded anything. Maybe I should do what you suggest and don’t bother. Thanks for being honest

Stevon8ter thanks, I am willing to learn and I want to learn, the hard part is not knowing how long it may take, I am not silly enough expect to be making games in days but I wouldn’t want to spend many 100s of hours and have nothing worthy of showing

Jakattak thanks, that is good to know.

Thanks all for your input, I will consider things.

Something like Jetpack Joyride would take a lot of effort and time in any language not just lua in codea, but it would be easier in codea for sure, but everything after the drawing will be quite hard in any language for a beginner. It’s not hard to learn though, if that’s what you’re worried about. @Tyson it might take you a 100 or more hours to learn codea to the extent of making a good game like jetpack joyride, with the polishing as well (finishing touches) depending on how you learn and how much thought you put in to it, but it is well worth it.

@Tyson I didn’t mean to give up before you start. I meant to look at existing code and see if it starts to make sense. Keep trying and if it doesn’t work after you tried enough, then give up.

Thanks Luatee and Dave1707, let me tell you my plan.

I would like to program my own fruit machine game, now I don’t mean these silly new ones with 30 winning lines and dozens of features. No

I would like to program an old fashioned 3 reel slot machine, like the old penny OXO ones, no features, no nudges, no special effects.

You people know, would that be far beyond the range of a newcomer to codea and programming?

Appreciate your opinions, thank you.

Anything is possible in Coding! It might take a little time, but its totally possible!

Your best bet is learn some lua first. It’s an easy language to pick up and you can use it on a pc or mac. Or you could just buy Codea and start your addiction…

@Tyson You said you’re a total non programmer. Do you know or understand the purpose of “if” statements, “for” loops, “tables”, and the use of variables. Would you say you understand logic and how to solve or break down a problem into it’s smallest parts. I think if you can say yes to those questions then that’s a small start to learning how to program. After that, there’s still a lot more that you’ll need to learn.

Dave1707 thanks for replying again, I do not know those, nope.
If statements, for, loops, tables , variables? Already sounds pretty complicated.

I think I have all the info I need.

( @Tyson - Just a side note, I thought I might let you know if you put an “@” sign before a user’s name, they’ll get notified that you mentioned them. It’s very useful. Thanks! )

@Tyson making a 3 reel slot machine in 2d would be really easy.but you will have maths and logic.

@Tyson I suggest you learn what variables, ifs, etc are before you start trying to program a game. Don’t try and run before you can walk!

@Tyson Here is a simple program that uses everything I mentioned above. An “if” statement, a “for” loop, a variable, and a “table”. It puts the values of 20, 40, etc, to 200 into 10 entries of a table. It prints those table values on the screen. If the table value is 100, it prints more text. I added comments on the lines. Look this over and if you can understand this, then you should be able to write programs because this is a lot of what you’ll use. If you can’t understand this, then put it down and look at it later. Keep doing that until it makes sense, because writing programs on an iPad with Codea is a lot of fun. If there’s something you don’t understand, there are a lot of people here that will help. Just don’t ask us to write a whole game for you. Also, what is your age so we know how to respond to questions.


function setup()    -- this function runs once at startup
    tab={}    -- define a table called tab
    for a=1,10 do    -- loop, increment the variable "a" from 1 to 10
        tab[a]=a*20    -- put the values of "a" * 20 into the table position "a"
    end
end

function draw()    -- this function runs at 60 times per second until stopped
    background(40, 40, 50)    -- clear the screen to color 40,40,50
    fill(255)    -- draw with the color "white"
    for a=1,10 do    -- loop, increment "a" from 1 to 10
        text(tab[a],100,HEIGHT-a*50) -- show table value on the screen
        if tab[a]==100 then    -- if table value is 100, show more text
            text("tab value is equal to 100",250,HEIGHT-a*50)
        end
    end
end

Note: Two dashes, i.e. --, is a “comment.” This means that text after that on the line will not be read my the program as code. Comments aren’t necessary, but make it easier for the human to understand the code.

code here -- now this is a comment, not read by the program.

A variable is pretty much anything. It’s very simple. They can be numbers, strings, booleans, tables, and functions. Numbers, you can guess what those are. A “string” is a fancy programming word for text, you put them in quotes, like “a string.” A boolean is another fancy programming word that’s just a true or false value. A function can do anything you want. It’s like a separate block of code that you can run multiple times rather than writing it all over again. You could have something like this as a function:

function hi() -- This says that from here on is the code for a new function, under the name "hi."
    print("Hello World!") -- This prints the text "Hello World!" into the output, or "console."
end -- This tells the computer that the code for our function "hi" is finished, and that whenever we run "hi," (i.e. hi() to run it) it should only execute the code after the keyword "function" and before the keyword "end."

print() is another function, it takes any variables you have, such as the string “Hello World!” and puts it in the output, or console.

Another thing to note is that, with most variables the definition syntax (how the text should look for it to work) is like: variableName = variable, but also, for functions, just to make it look pretty, you can use function variableName() instead.

Variable names can be anything that doesn’t include a =, +, -, or a space. You get it, just alphabetical characters and numbers.

In the place of “variable” back there, it can be 0, 1, 2, 3, any number, even negatives. Or it could be a string, like “Hello World!” so the code would be variableName = "Hello World!"

A boolean in that case is simple, just do: variableName = true or variableName = false.

A table is a list of sorts. Imagine you have a bunch of variables, say maybe 10, but you don’t want to have a name for every one of them. Then you can do something like:

myTable = {} -- Create a new variable, under the name "myTable." This variable will be a "table" variable.
myTable[1] = "string" -- This will create the first "element" in the table, to the variable "string."
myTable[2] = 0 -- This will create a second "element" in the table, to the variable 0.

-- Now we can access these variables, like this:
print(myTable[1]) -- Prints the first element in our table, "string."
print(myTable[2]) -- Prints the second element in our table, 0.

If you want to test out code like this or try programming, Lua is available for all platforms, but it doesn’t have drawing like Codea does. See lua.org for more details, tutorials, and downloads.





if statements are a little bit more complicated. They need one variable. Their “syntax” is like this: if variableName then

An example of their use is:

theBoolean = true -- Create a boolean variable, "theBoolean."

if theBoolean then -- If our variable "theBoolean" is true, run this next code:
    print("It is true!") -- Simple print statement.
else -- theBoolean was false, so instead of the code above, we run this code below:
    print("It is false!") -- Simple print statement.
end -- We are done with this if statement, any code after this is not affected by theBoolean.

An “else” in the middle is not required, but if you want to run some code if the variable you gave the if statement is false, then you can have it to run code for if it’s not true.

I’m not going to cover while and for statements for now, those are too complicated for a beginner.

@Tyson As far as programming languages go, Lua, and by extension, Codea are quite simple to learn. While there are some advanced programming techniques available, you can just ignore them and still accomplish some truly amazing stuff. And when if you decide to learn the advanced stuff, you’ll find it’s quite simple, too.

The one great joy of Codea is that you can just press a button to run your code. It will either do something (hopefully what you expect! :wink: ) or Codea will point out an error. It’s very immediate so you can easily edit, fix, or expand your code.

If you poke around on the forum, you can find code examples with video of what they accomplish. For example, check out this recent beauty: http://twolivesleft.com/Codea/Talk/discussion/4372/matching-colors-board-game-video-gist-community-codea