Function load not being called from graphics?

Hello,
I am following a course on Udemy, it’S game development with LUA and a program called LOVE. Which I never heard of. I basically follow the tutorial and ignore any of the commands that require me to type in love.(etc…)

Everything has been working fine, up until this point. Here’s my issue.

  1. We are creating a button that appears throughout the screen and moves quickly, you have to press the button before it repositions itself. It’s on a timer.

  2. The button in the game is a circle (Ellipse)

  3. The instructor wants us to add the dimensions (x,y,radius) from the function load and add them into function draw to the right of the Ellipse within it’s parenthesis. (See the 2nd image attached)

  4. Problem here, when I do that, I get the following error message (See 2nd image - look on the left side)

  5. If I do not add the function load statements into the Ellipse, everything works fine. (See 1st image, lower left side)

  6. But… that’s the issue with number 5 above, the instructor states, the function load, is the first to load when the game starts, thus, my ellipse needs to get it’s instructions from there. (For the instructor’s code see the 3rd image)

Please advise.

I AM A BEGGINER TO CODING AND GAME DEVELOPMENT:
About 3 months old. I am initially learning C# since I will be developing on Unity platform for Virtual Reality. My business partner and I have a VR Arcade which we are turning into a LBE (meaning our own VR developed experiences).

However, since I am currently in the middle of a transition, I do not have a pc around me, Thus, I require my iPad to maintain practice and repitition, so comprehension and learning can sink in. So here I am with Codea and LUA.

I say all that to say this, I am just starting to comprehend Variables, Namespaces, Classes and other abstract concepts of programming, and so, pardon me, if I am not expressing with the correct terminology.

@tactfulgamer Here’s an example that shows the x,y,radius.

function setup()
    b=button(200,300,30)
end

function draw()
    background(40, 40, 50)
    b:draw()    
end

button = class()

function button:init(x,y,r)
    self.x=x
    self.y=y
    self.r=r    
end

function button:draw()
    fill(255)
    ellipse(self.x,self.y,self.r)
    str=string.format("(%d,%d,%d)",self.x,self.y,self.r)
    text(str,self.x+75,self.y)
end

@tactfulgamer replace load() by setup() in your exemple

Thank you guys.

@Diablo76 thank you, unfortunately it’s not working. Has to be something I am doing. Getting too much resistance trying to just learn. I’ll come back to that lesson when I feel I have learned more.

I’ll just check YouTube for some Codea developing a game guide. Such an amazing app “the power to create living, breathing worlds. From your tablet or phone.

I hope it has a strong YouTube community. I guess I’ll find out.

@tactfulgamer Instead of trying to learn Codea by looking at examples from a different source, try looking thru the examples here in the forum. There are plenty of them from very simple to very complex. If you want an example for something specific, just ask and either I or someone else will whip one up. The quickest way to learn Codea is to look thru the reference to see what commands are available and to look at and modify existing examples to see what they do. Trying to convert a program from one source to another just makes things harder.

@dave1707 Thank you. This makes sense. The illumination is appreciated.

I am just looking to be shown how to create.

What would you recommend for a 3 month noob whom understands some of the basics:

variables, functions, setup, table.

I am yet to learn what init does,
I am yet to learn what are the extra tabs, we would create to house code (I have no idea why we would create another tab) But honestly, these are things I can find on my own.

_**I just want to start creating! **_I am a hands on learner.

At the moment, I would LOVE to learn how to create a basic isometric game ala’ Firaxes XCOM like game. But SUPER simple, few cover areas, one weapon, just 2 or 3 enemies, all in one area, add sound effects or scripted voice sequences for my character.

If Codea cannot create something like that…

A super basic Mario brothers like game with one level game will do. If none of what I ask exists or is not possible, just toss me walkthrough game creation guide, I can follow step by step, with what they are creating, so I can gain comprehension.

SEARCHING FORUMS:
I tried searching with the limited time I have, and honestly I have no idea where to go, it’s daunting. (See attached image, I have arrows pointing to so many locations, I’m getting dizzy just being there)

Maybe a section that says “Hey Noobs click here!” Can help us on where to go.

Right now just a lot of big words and jargon I do not yet understand, and so naturally - overwhelming sets. Also my time limitations innately push me to YouTube, see what they have, follow along.

At the moment, learning from this guy, though it’s old, so I have no idea if coincides with current Codea:
https://youtu.be/Aj43kuCTT84

@tactfulgamer I’d start with an even simpler game

  • Bubbles float up the screen
  • Tap on them to pop them
  • Keep track of the score on the screen
  • If one bubble gets past the top of the screen it’s game over

It’s very basic but something like that will give you problems to think about if you haven’t done much programming before.

You’d need to break it down into steps: how do you tell if someone has touched a bubble? How do you make an infinite number of bubbles rise from the bottom of the screen? What do you do to reset the game? And so on

The YouTube video you linked still applies

@tactfulgamer It sounds like you’re being too aggressive in what you want to do compared to what you know. You’ll probably be able to do what you describe above, but it’s going to take awhile for you to get there. If you want more things to look thru, try link below. A lot of what’s in there is probable more than you will need right now, but keep it in mind. Have you looked at what’s in the Wiki link at the top of the forum right next to Reference. There’s a lot of info in there that will help. As for what init does, you’ll learn more about that when you learn about classes. When you create an instance of a class, init is the function that gets called first. That’s similar to the setup function in normal code. As for tabs, instead of having a whole lot of code in the main tab, you can put code in different tabs. The code in each tab could do specific things to make it easier to keep track of what’s where in very large programs. Think of chapters in a book. Instead of having everything in one chapter, things are broken down into different chapters. It makes it easier to find things because they’re in similar groups. You have a lot to learn, but it’s going to be fun and well worth it as long as you don’t try to do things far beyond what you know yet. I’ve been using Codea for 7 years and I’m still learning new things. It’s a fun process.

Also, if you have questions about anything just ask. That’s what a lot of us are here for.

https://coolcodea.wordpress.com/page/1/

@dave1707 Thanks, very good link. Excellent pointers.

thanks to your instruction, I have been checking out the wiki and reading up on the first LUA manual. I agree with what they have been saying, very elegant indeed, going off the little I know. A lot more simple to pick up than c# for sure.

I see Codea has some AR related stuff in the assets section, which leads me to believe, you guys are forward thinkers and are seeing ahead to the near 2-3 year incoming future.

Question for you guys I am not sure if you’re with the devs behind Codea. In case you are - will you be making Codea compatible for the upcoming Oculus Quest VR headset or any Virtual Reality hmd’s?

That said, if it is not something you guys are planning… I honestly won’t be sticking around. Though this is beautiful community from what I have gleamed. Unfortunately, if I am not able to use my time invested knowledge from (LUA/Codea) to develop on a Virtual Reality environment (Oculus, SteamVR). Then I have no reason to be here, once I get my surface 3. This is my sole purpose for wanting to learn code. A deep burning desire to craft virtual experiences.

Codea is my… at home way of practicing to code, familiarizing myself with universal syntax concepts while on my iPad. This iPad thing, will also change once I pick up the surface book 3 (which I am patiently waiting for - rumored this year) Since apple makes it extremely difficult to advance within gaming industry as a student (No Unity, no reliable IDE for c#) I’m leaving the eco.

I say all that to say this, this is why I approach aggressive to learning here, to learn what I can, with the small time I have here. Something tells me, Codea will not shift to provide compatibility to create games for a Virtual environment, with the existing VR platforms. And so, I gotta move a certain way - fast.