that was the problem, so i added those variables into my table. it worked, but now my player wont move.
Printable View
that was the problem, so i added those variables into my table. it worked, but now my player wont move.
i think you should do:
just switch them that way your player.x and player.y will not be the ones changed, allowing you to moveCode:Player[1].oldx = Player[1].x
Player[1].oldy = Player[1].y
nope didnt work any other suggestions
p.s. thanks for all the help everyone
His solution was for my bug report.
ok sorry for bugging everyone, but ive got all errors fixed, but i just implemented jumping. now it says my guy is jumping, but he does not appear to be jumping how to i mkae it so he actually changes his "y" value and then comes back down?
Quick Question:
What does that do, return to Lowser?Code:return
can someone please tell me where a simple enemy code is
Returns from the current function.Zitat:
Zitat von pspfreak9
-= Double Post =-
http://google.comZitat:
Zitat von pspaquaforce
Ok, I need some help with a bit of code for printing text centered on the screen with truetype fonts.
Here's what I have so far:
Code:blue = Color.new(0,0,255)
hyper = Font.load("fonts/hyperion.ttf")
hyper:setPixelSizes(10, 20)
function printCentered(font, y, text, color)
local length = string.len(text)
local x = 240 - ((length*10)/2)
screen:fontPrint(font, x, y, text, color)
end
screen:clear()
printCentered(hyper, 100, "This is a test", blue)
printCentered(hyper, 200, "This should be centered as well", blue)
screen.flip()
while true do
pad = Controls.read()
if pad:start() then break
end
end
Since I've set the font width to 10, If I were using a fixed width font then 240 - ((length*10)/2) or (half of the screen width)-((number of characters in the text string * the pixel width of the font)/2) would center the line. But since I'm using a variable width true type font it's actually coming out to the left of center.
Can anyone tell if there is a function that can give me the actual pixel length of a string of text when using a variable width font?
*edit*
LOL, I post a question then find the answer myself a couple minutes later:
Code:hyper:getTextSize(text)["width"]
ok i added everything the only thing left is (dramatic silence) collision.
i added collision on another image and its right, however its giving me an error saying i need to add an end to close my 'while'.
i have an end at the end of the while true do loop that would end it so i dont understand whats wrong
any ideas?
Check your entire code to make sure every IF and WHILE has an END.
:Jump:
nevermind i fixed it
Would you mind posting your code? Or PMing it?
Here is a simple enemy code
Just edit the code to fit your game, Very simple.Code:enemy1=Image.load(....) --// enemy image
Enemy= {}
Enemy[1] = {x = ... , y = ...} --//X and y Position of Enemy
function moveenemy() --dont forget to call the function
--your enemy movement function
if you move right then
he moves to you
end
end
screen:blit(enemy[1].x, enemy[1].y, enemy1)
the function part is what i am having trouble onZitat:
enemy1=Image.load(....) --// enemy image
Enemy= {}
Enemy[1] = {x = ... , y = ...} --//X and y Position of Enemy
function moveenemy() --dont forget to call the function
--your enemy movement function
if you move right then
he moves to you
end
end
screen:blit(enemy[1].x, enemy[1].y, enemy1)
...Zitat:
Zitat von pspaquaforce
yes i thought the code you gave me would work so :down:
-= Double Post =-
http://img341.imageshack.us/img341/9229/snap0001oz3.png its really gay witout shake moving
shake should be kicking meatwads @$$ by now all he can do is give him that funny look
I KNOW ITS SO GAY WITHOUT SHAKE MOVING!Zitat:
Zitat von pspaquaforce
...
...
:dry:
(man I need to stop going to this thread..)
HELP ME:Argh: didn't i send you the code but you didn't pm me back huh
youresam's thoughts " that retard pm again i thought i was done with him"
or did you think of that
Is this kind of like what you are looking for, pspaquaforce?
Spoiler for function:
Use trial and error (or post your code).Zitat:
Zitat von %chrono trigger%
EDIT: To below:
That'd be silly.Zitat:
Zitat von Anti-QJ
Dude, It you cant edit the template i gave you, You shouldnt be coding, Unless your copying and pasting?
Give me a coder who came after evil-mana was created and doesnt do that, and I will give you a dollar.Zitat:
Zitat von Anti-QJ
A good coder?Zitat:
Zitat von youresam
Tactical Pinguin.
I will be waiting for my dollar :)
Damn it, Anti beat me to the punch
NVM, I forgot about his Chase the penguin game.
mmm I didn't copy and paste any thing with PvP Pong, but then again, its only Pong.....yup, hard to find one :S
Sorry, You cant count :9
But your an awesome coder!
Hey anti, I guess that chance at getting rid of the sig limit just left. FFS I was a noob back then, look what I've made/am making now.
But you dint arrive AFTER evilmana.com
Come on, Just put the sig limit to 150, Thats BS
Yea I did.
how do you find the point where 2 lines intercept?
That's basic math. You have to know the endpoints. Then you find the equations and set them equal to each other. Quick sample.Zitat:
Zitat von eyece
There might be an easier way, I don't know. This really isn't that hard. It just looks like a lot of work.Code:Endpoints:
(0,300),(300,0) - (1,1),(401,201)
Slope Forumula(Find slope of lines):
y2-y1
_____
x2-x1
0-300
_____ slope = -1
300-0
201-1
_____ slope = 1/2
401-1
Point Slope Forumlua:
y - y1 = m(x - x1)
y - 300 = -1(x - 0)
y = -x + 300
y - 1 = (1/2)(x - 1)
y = .5x + .5
Now set them equal to each other.
-x + 300 = .5x + .5
299.5 = 1.5x
199.666 = x
Now substitute that in for x to get the y coordinate:
y = .5(199.666) + .5
y = 100.333
Point where they cross:
(199.666,100.333)
... you killed my brain.
How old are you? Because this is like 7th grade stuff.
you dont understand that?Zitat:
Zitat von eyece
wow, i really dont think you're ready for programming yet.
wait till 8th grade atlest. learn algebra.
lol anyway is there a tut or do you guys have an example of how to load a file if my player collidies with an image?
Code:if (player collides) then
file = io.open("myfile.txt","r")
text = file:read()
file:close()
end
ok can you tell me what the lines of code with the arrows mean?Zitat:
Zitat von Access_Denied
and what would I put in here -----> (player collides)? the 2 images?