How do you put text before the game starts?

You know when games put there logo then it flashes to the start of the game? If you know what I mean could you try to help or send me the coding. :slight_smile: thanks

This is how I do it:


sub draw()
   if (ElapsedTime < 5) then
      drawtitles()
   else
      drawmain()
   end
end

drawtitles() is the function to draw my title screen, drawmain() is the function to draw my main program. This will, obviously, give you a 5 second flash screen. You could do other stuff, like setting a flag and waiting for them to tap - the point is you just have a conditional in your main draw() loop to decide what should be drawn right now - and go do it.

sub? SUB? What is going on here, @Bortels?

A lot of programming language skills. Right?

lol, my other languages grabbed my forebrain for a bit. I’m not even sure what language that’s from… perl, probably.

It’s the perils of adding code without testing - you miss lame errors. Funny part is, I also had the “<” reversed, but I caught that.

It should be “function”, of course. (I like “sub” - it’s shorter.)

sub can be found in QBasic. It is similar to a function.

Hi All,

Now that’s not classy - SUB!!!, everyone knows it’s GoSub!!!
But, after this thread and playing on CargoBot, something occurred to me. In BBC Basic we used to use Chain to run one application from another. Do we have anything like that in Codea? Except of course function!!
The beauty of Chain is that the memory claimed by the first program is freed for the Chained program. So you can make quite a sophisticated Intro program, without detriment to the Chained one.
Which raises a question - in iOS when is an application removed from the memory?

I know there are commands within Lua to tidy up memory, so it is of concern.

Bri_G

:slight_smile:

@zoyt - it wasn’t QBasic. I promise. Although I did once write a certification program for Quarterdeck (Makers of DESQView and QEMM, welcome to the 90’s) in QBasic. :slight_smile:

It was perl. I checked! A lot of my “real world” job ends up being “this is boring - I know, I’ll write a perl script to do it for me!”. I think in perl; when I write lua, my brain actually has to to a translation step, and sometimes that misfires…

I like @Bri_G’s suggestion - it would be pretty cool if we could have a Codea function that said “ok, we’re done here - go run this other project”.

what i did for my title screen is i built a title screen so when i press play it shows that. then in main, i set it so that if you touch the screen it runs the program. so,

function touched(touch)
if CurrentTouch.state == BEGAN then
function draw()
–Everything your program should draw