It looks like you're new here. If you want to get involved, click one of these buttons!
Like having a initial setup for a whole program, is there a way to have initial setup for a gameState using finite state machines. Right now, what is happening is that a physics object is being drawn for the run state but is invisible.The problem here is that I'm using @Reefwing's tutorial and making spheres fall down from the top during the menu state. I only need the physics object (a wall) to be drawn once, so that is why I'm not putting it in the draw function for the actual run state. please help!! I'm new to codea and am getting really frustrated with these sort if things. Sorry if I'm spamming with these questions. :-(
Comments
Why don't you try physics.pause()?
And if you need a setup for each game state, you should have a function to change from one state to another, so put all your setup code in there.
pausing the physics won't work as it will pause all of the physics. I'm interested in creating a function from changing from once state to another. right now, I'm just using function draw() to change from one state to another and drawing the different states. How do you think I would go about doing this? :-?
How are you using draw() to change states?
How are you using draw() to change states?
I usually do it like =
I left out the rest of the functions as I am making this up as I go along (My dad has poached my iPad for a week) so if there is a syntax error, I apologize.
I started off using @Reefwing's minesweeper game and broke it down to he basics. I change states like this.
But where is your code that says
gameState = stateRun
orgameState = stateMenu
?@Jordan here in the setup function
I do it like this:
I prefer string names to numbers, so I won't be confused if I choose to pick up an abandoned project
No, as in
here's something like that for my title screen:
So in that if clause, initialize all your physics objects.
@Jordan how would u do that and what is the code for that? Does it go in a separate class? My code is very similar to @RichGala1 as in changing state like that.
You would just cut the code from your setup function where you make the objects, and give them their properties, and paste it to the if clause. If I provided code for you it would be messy, (probably) full of mistakes (My dad has taken the iPad for a while...), and you would have to adapt it to fit your code. If you really want me to put up code could you post yours?
if I were to paste my code, I would have to paste a total of seven classes. I'm in a car right now and my iPad doesn't have wifi. I'm doing this through my iPhone
I got it working guys I just put the function for creating the wall where I set the different game parameters for each difficulty
O.o Ok. I'm stuck for now...
P.S. You can copy an entire project by selecting the entire project from the Codea menu, hold your finger over it, and select copy. It will be copied as text.