RPG game creation with Corona SDK

Hi,

I would like to know if anyone attempted to build a mobile rpg game using corona sdk?

I am at the moment building a small rpg engine using corona sdk with basic functionalities, just wanted to know if anyone has any past experience developing rpg game using corona. Thanks.

With regards,

Shahjada

Hello,

Do you want to create a real 3D game or a 3D isometric RPG?

What do you think it will be your major difficulties?

Hi remiduchalard,

I am mainly interested with a top down rpg style 2D game. Not focusing on 3D or 3D isometric rpgs, since it is my starting point.

The current difficulty I am facing is : character jump in 2D, but will need to study a bit more to get it sorted out.

To manage jumping character you can do :

Visual effect Increase the size of the character to show the jump (with transition to make it beautiful)

Jump over object and be block in front of a wall, you have a few option. You can define jumping object. For example : You can jump over everything expect tree and all building. All tree and building a in table. Calculate the distance between the character and every object. If the distance is high it’s mean it can jump over every thing. You won’t have lag if you don’t have to calculate distance with more than 500 objects(if you have more I can explain you some solution).

Or if you are map are build with tile, you can have a table. 1 is where you can walk, 2 where you can jump and walk, 3 where you can jump, 0 you can’t go

I don’t know if I answered to you question. Please precise you difficulties if you want more details answer :slight_smile:

Let me be a bit more precise. I am using 2d Tiled map editor. When the character moves it is always in touch with the ground. When the jump button is pressed, the character does jump but I am having difficulty coding collision of character with the ground. I am using set linear velocity, but the velocity is in the y direction not z direction (dont think it is possible for character to jump in z direction). So this means when jumping the character is in touch with the ground, so a bit confusing.

I am sorry but I never used physics someone else will help you with that :slight_smile:

Could you please let me know precisely how I can do the jump without physics, bit of code would be helpful. Thanks

Ok,

to have the animation(go up):

transition.to( character, { time=1500, xScale=1.5,yScale=1.5,transition=easing.continuousLoop})--add a listener to detect when the player is back on the ground(transition support on finish transition listener isJumping=true

move in any direction :

local movingX=0 local movingY=0 -- add button who move the player. For example with a joystick, movingX can go from -1 to 1 and for y too -- and to add inertie if the joystick is it in up position for more than 1 second the movingY go to 2. local myListener = function( event ) print( "Listener called with event of type " .. event.name ) --this happen every new display frame local nextX=character.x+movingX local nextY=character.y+movingY if(canIgoHere(nextX,nextY))then character:translate(movingX,movingY) end end Runtime:addEventListener( "enterFrame", myListener )

If you have tiled map, you can have in a table all data about area:

local myMap={} for(i=0,10)do -- initilisation for(j=0,10)do myMap[i][j]=0 end end myMap[0][0]=1-- walking tile myMap[0][1]=2-- walking and jumping area myMap[0][2]=3-- jumping tile -- that assume that the character can't go anywhere else -- obstacle detection, on which tile the character is : theXtile=math.floor(character.x/100) -- for example each tile is 100 pixel of width theYtile=math.floor(character.y/100) -- to know if the player can jump function canIJump() if(myMap[theXtile][theYtile]==2 or myMap[theXtile][theYtile]==3) jumpIsPossible=true return true else jumpIsPossible=false return false end end function canIgoHere(x,y) if(isJumping==false) then if(myMap[math.floor(x/100)][math.floor(y/100)]==1 or myMap[math.floor(x/100)][math.floor(y/100)]==2) then return true else return false end else if(myMap[math.floor(x/100)][math.floor(y/100)]==2 or myMap[math.floor(x/100)][math.floor(y/100)]==3) then end end

do you get the idea of how to make it? for information you can create automatically the myMap array if you code a few dozen of code line

there is a lot of way to do it, if you need another way I can do it for you

Thanks for the code snippet. 

I used 

transition.to( character, { time=1500, xScale=1.5,yScale=1.5,transition=easing.continuousLoop})–add a listener to detect when the player is back on the ground(transition support on finish transition listener

isJumping=true

modified it to move from y position to y+shift position, however I am not sure how to prevent double tap on the button when the object is moving upwards. When I tap again during the transition, the body moves again in y direction. Any clue how to prevent double tap so that the body only moves a certain distance and comes back to original position.?

Thanks

It’s easy to avoid that:

Your listener :

local function listener2( obj )     isJumping=false end

You transition :

transition.to( obj, { parameter, onComplete=listener2 } )

The function listener2 will be call when the transition will be finish.

When you detect the tap verify that the value “isJumping” is false.

_G.myCircle = display.newCircle( 100, 500, 30 )

myCircle:setFillColor( 0.2,0.7,0.8 )

local button = display.newRect( 300, 900, 200, 80 )

button.alpha = 0.6

function button:touch(event)

  if event.phase ==“began” then

    button.alpha = 0.4

    transition.to( myCircle, { time=500, x=myCircle.x, y=myCircle.y-200, 50, onComplete=button } )

    isJumping=false

  end

  if event.phase ==“ended” then

    button.alpha = 0.6

    isJumping = true

    transition.to( myCircle, { time=500, x=myCircle.x, y=myCircle.y+200, 50, onComplete=button } )

  end

end

button:addEventListener(“touch”,button)

Can you help me modify this code so that it simulates jump under gravity please, without using the physics in corona?

I can still do double tap in between jumps and this is problematic.

When I press on button and keep it pressed the circle moves up, but I can double tap and this interferes with the movement. The same when I release the button. Video link : https://goo.gl/5czBv5

This is quite frustrating :frowning:

Also I need to make sure the jump is smooth like having gravity, so I possibly need to use a gravitational equation

Please provide me fixed code if possible!

In private message I will provide all details to make it done :slight_smile:

Thanks a million to remiduchalard, he assisted me in figuring out jump without using physics. I just need to adjust the time between transitions to make it look like it is under gravitational force. This thread can be closed now. If anyone wants to look into the code, please ping here.

Hello,

Do you want to create a real 3D game or a 3D isometric RPG?

What do you think it will be your major difficulties?

Hi remiduchalard,

I am mainly interested with a top down rpg style 2D game. Not focusing on 3D or 3D isometric rpgs, since it is my starting point.

The current difficulty I am facing is : character jump in 2D, but will need to study a bit more to get it sorted out.

To manage jumping character you can do :

Visual effect Increase the size of the character to show the jump (with transition to make it beautiful)

Jump over object and be block in front of a wall, you have a few option. You can define jumping object. For example : You can jump over everything expect tree and all building. All tree and building a in table. Calculate the distance between the character and every object. If the distance is high it’s mean it can jump over every thing. You won’t have lag if you don’t have to calculate distance with more than 500 objects(if you have more I can explain you some solution).

Or if you are map are build with tile, you can have a table. 1 is where you can walk, 2 where you can jump and walk, 3 where you can jump, 0 you can’t go

I don’t know if I answered to you question. Please precise you difficulties if you want more details answer :slight_smile:

Let me be a bit more precise. I am using 2d Tiled map editor. When the character moves it is always in touch with the ground. When the jump button is pressed, the character does jump but I am having difficulty coding collision of character with the ground. I am using set linear velocity, but the velocity is in the y direction not z direction (dont think it is possible for character to jump in z direction). So this means when jumping the character is in touch with the ground, so a bit confusing.

I am sorry but I never used physics someone else will help you with that :slight_smile:

Could you please let me know precisely how I can do the jump without physics, bit of code would be helpful. Thanks