RPG Logic Organization

RPG Logic Organization

Curt's picture

As a few of you know, I am currently working on an RPG for iOS. Since I have finally gotten past the point of getting a good tile engine set up, adding characters, collision detection, character dialog, touch events, etc, I thought it was finally time to start actually making the game (depressed sarcasm intended).  Overall it looks pretty solid right now: runs on my iphone 4 relatively smoothly and astetically looks very nice (thanks to many of the LPC asset donators whom will be attributed in my credits).  

My problem: What is the best practice for organizing the main story's logic?  As in: Do I just make a variable to represent what part of the story they are on?  

(I'm using lua)

local gameStoryVariable = 0

if character.x==5 and character.y==6 then

gameStoryVariable=1

end

(now I'll use psudo code to get my point across)

if gameStory Variable==1 and quest1 completed then

gameStoryVariable=2

end

if key was found and gameStoryVariable==2 then

gameStoryVariable=3

end

 

This seems very inefficient and leaves a bad taste in my mouth.  Any better ideas?  Btw, I'm pretty horrible at programming and am self taught, so please forgive.

 

-Curt