abi>>forums

abi>>forums (http://www.anythingbutipod.com/forum/index.php)
-   Zen X-Fi2 Applications & Development (http://www.anythingbutipod.com/forum/forumdisplay.php?f=221)
-   -   Mario Development Thread (http://www.anythingbutipod.com/forum/showthread.php?t=63872)

jameswalker101 06-21-2011 03:05 PM

Mario Development Thread
 
2 Attachment(s)
LAST UPDATED 30 June 2011

This is super mario bros for the Zen x-fi 2.

This is what I have done so far:

Intro Screen
Mario Moving Right
Mario Moving Left
Menu (new!) ( see second thumbnail)

This is what I have to do:
Mario Jumping
Enemies
Maps
Bricks


Can anyone think of a name for the game? Thanks

alexvilla 06-22-2011 03:37 AM

Quote:

Originally Posted by jameswalker101 (Post 559839)
Can anyone think of a name for the game? Thanks

Mario

datallboy 06-22-2011 10:01 AM

Super Xfi2 Brothers! XD

jameswalker101 06-22-2011 01:03 PM

Quote:

Originally Posted by datallboy (Post 559952)
Super Xfi2 Brothers! XD

Nice...

jameswalker101 06-23-2011 02:49 PM

Coding problems, Mario not moving.
 
Hi, this code is meant to load the background and mario images, and when the RIGHT half of this screen is pressed, mario should move, same for LEFT.
But the movement doesn't happen.

What am i doing wrong?

Is there anything I am coding wrong?

Thanks.

Code:

background = image.load("background.jpg")
background:draw(0,0)
screen.update()
Mario = image.load("Mario.png")
screen.update()
os.sleep(100)

playerX=106
playerY=158
Mario:draw(playerX,playerY)
screen.update()
X=373
Y=0

Mario:draw(playerX,playerY)

while true do
x,y = touch.pos();

if
X>=201 then
string = 1
print(string)
playerX=playerX+3
background:draw(0,0)
Mario:draw(playerX,playerY)
elseif
X<=200 then
string = 1
print(string)
playerX=playerX-3
background:draw(0,0)
Mario:draw(playerX,playerY)

screen.update()
end
end


jbob182 06-23-2011 03:07 PM

I went through the code and fixed it all up

http://snipt.org/xkloj

Here is what was wrong:

first off , when you put this :
x,y = touch.pos(); you used lower case x and y but you use capital X and Y in your ifs (Lua is case sensitive), also you should keep a screen.update() at the end of a loop, you had it only update when the user touched the left half, also NEVER name a variable string (string is a module ie: string.find() and by naming something string you override the module). One other thing, dont load up the screen.updates while loading variable, and also please indent, by doing so it is alot easier to catch the majority of bugs ( i found this out the hard way :) )

One last tip, when naming resources like an image try and use a name like this:
"marioimg"

jameswalker101 06-23-2011 03:19 PM

THANKS! that helped.

Habhome 06-24-2011 11:43 AM

[Threads Merged]

Please ask questions regarding your game in the dev-thread dedicated to it, that's what it's there for to begin with..

jameswalker101 06-24-2011 12:46 PM

Jumping and Scrolling
 
Quote:

Originally Posted by Habhome (Post 560277)
[Threads Merged]

Please ask questions regarding your game in the dev-thread dedicated to it, that's what it's there for to begin with..

Ok, I am new to lua so i may need a lot of help...

How can I make Mario jump, I have a playerX and PlayerY variable, how can I change this to make him jump?

And, how can I make the game scene scroll when the player is near the right edge?
Thanks...

Nediam Nori 06-24-2011 01:29 PM

Where can i download mario for zen x-fi2?

Habhome 06-25-2011 06:54 AM

It is not finished Nediam... Development just started some days ago from what I know, can't expect to get a finished game that fast.

Nohajc 06-25-2011 07:38 AM

Good luck with the game development, james. I hope you'll have the patience to learn. :)

I've done ZEN Tower as my very first app in lua and it worked well, so you definitely have a chance.

As for the jumping: You'll need to simulate earth's gravity. That means you have a certain jump velocity (vertical) - number of pixels the character moves by per each cycle. In opposite direction there is the G-force acceleration, so the final vertical velocity will be v-gt where v stands for char's initial velocity in vertical direction, g is constant (9.81) and t counts (milli)seconds from the start of the jump.

That means you add v-gt to playerY in each cycle. (Provided you assign negative number to v - the "minus" sign designating up direction whereas gt will be positive because it "pushes" the char down.)

When gt gets higher than v, the character will start to fall so the last thing you'll have to do is to set the boundaries so that it doesn't fall through the ground. :D

This is the way I used in ZEN Tower, you can check my source code, function updatePlayerPos() to be specific.

jameswalker101 06-30-2011 02:28 PM

thanks, what about the scrolling screen? The game needs to be larger than 400X240 pixels!

jbob182 06-30-2011 02:40 PM

Quote:

thanks, what about the scrolling screen? The game needs to be larger than 400X240 pixels!
We have dealt with this in Pingus, you need to crop the map into several jpgs's (size cant be more than 400x600) and then tile them.

Nohajc 07-01-2011 01:40 PM

Yes, regarding the actual scrolling process, I'd see it like this:
You can have character's absolute position defined and then also the world offset (the visible part).
Then you can easily change these values and have the final screen position determined by the subtraction of each two values (relX=absX-offX and the same for Y possibly).

Finally, you just add an if statement of some kind to check relX and toggle screen scrolling.

datallboy 07-01-2011 03:05 PM

use the name i came up with :P lol

jameswalker101 07-29-2011 04:06 PM

Quote:

Originally Posted by datallboy (Post 561512)
use the name i came up with :P lol

Yes, I think that will be the name. More info soon on the game, I am working on coins and enemies. This game will be like the origianal Super Mario Bros, but with super mario bros 3 style graphics.


All times are GMT -5. The time now is 12:23 PM.