QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

[WIP]LuaPhysics: Demo

This is a discussion on [WIP]LuaPhysics: Demo within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I was bored one day and made a small 2d physics demo for the psp. there is only one bug:The ...

Reply
 
LinkBack Thread Tools
Old 07-05-2007, 05:20 PM   #1
 
Join Date: Jul 2006
Posts: 50
Trader Feedback: 0
Default [WIP]LuaPhysics: Demo

I was bored one day and made a small 2d physics demo for the psp.
there is only one bug:The box moves faster and faster rather than slower and slower(like it should be) anyway, I need Lua coders to help me develop it into a 2d physics playground.

if any one would like to help PM me.
Attached Files
File Type: zip LuaPhysics.zip‎ (1.0 KB, 6 views)
psp-freak222 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 05:30 PM   #2
 
xpack's Avatar
 
Join Date: Aug 2006
Location: Under Your Bed
Posts: 3,084
Trader Feedback: 0
Default

What exactly are you making
xpack is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 05:31 PM   #3
 
Join Date: Jul 2006
Posts: 50
Trader Feedback: 0
Default

Quote:
Originally Posted by xpack
What exactly are you making

A 2d Physics playground For the PSP.
psp-freak222 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 06:42 PM   #4
 
Join Date: Mar 2007
Posts: 755
Trader Feedback: 0
Default

what's physics?

even after that, i still don't really get it
__________________
[I][U]QJ took away my sig. :([/U][/I]
michaelp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 06:44 PM   #5
 
Mister Chief's Avatar
 
Join Date: Jul 2005
Location: Bungie Studios
Posts: 7,832
Trader Feedback: 0
Default

Physics: The science of matter and energy and their interactions.
__________________
[CENTER][IMG]http://i169.photobucket.com/albums/u240/Murasaki007/3060000000056603.gif[/IMG][COLOR=Lime]

[/COLOR][CENTER]
[/CENTER]
[URL="http://forums.qj.net/showthread.php?t=111647"]All Forum Policies[/URL] [/CENTER]
[CENTER]
[/CENTER]
Mister Chief is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 06:45 PM   #6
 
xpack's Avatar
 
Join Date: Aug 2006
Location: Under Your Bed
Posts: 3,084
Trader Feedback: 0
Default

Have you tried the program out...pretty cool the thing it does but he said he having a problem slowing it down, I haven't really looked at it but yeah
-= Double Post =-
Code:
System.usbDiskModeActivate()
object = Image.load("tux.png")
 posx = 240
 posy = 136
 weight = 0.6
 velx = 1
 vely = 3 


while true do
screen:clear()
pad=Controls.read()
 White = Color.new(255,255,255)
 oldx = posx
 oldy = posy
 posx = posx - velx
 posy = posy - vely
 velx = velx - weight 
 vely = vely - weight
 if posx > 480 or posx < 0 then
	velx = -velx 
	posx = oldx
weight = weight + .6 
 end
 if posy > 272 or  posy < 0 then 
	vely = -vely
        posy = oldy
weight = weight + .6
 end
 screen:blit(posx,posy,object)
if pad:r() then break end
screen.flip()

screen.waitVblankStart()
end
I put this and i did something REALLY weird

Last edited by xpack; 07-05-2007 at 06:47 PM.. Reason: Automerged Doublepost
xpack is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 07:11 PM   #7


Developer
 
Join Date: Jul 2006
Posts: 90
Trader Feedback: 0
Default

Well since the velocity can be negative, when you subtract the weight from it, it'll become even more negative (meaning faster right motion). So an easy fix would be to check if the velocity is negative; in that case, just add the weight instead (and clamp it to 0);
nataku92 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 07:18 PM   #8
 
xpack's Avatar
 
Join Date: Aug 2006
Location: Under Your Bed
Posts: 3,084
Trader Feedback: 0
Default

Code:
System.usbDiskModeActivate()
object = Image.load("tux.png")
 posx = 240
 posy = 136
 weight = 0.6
 velx = 1
 vely = 3 


while true do
screen:clear()
pad=Controls.read()
 White = Color.new(255,255,255)
 oldx = posx
 oldy = posy
 posx = posx - velx
 posy = posy - vely
 velx = velx - weight 
 vely = vely - weight
 if posx > 480 or posx < 0 then
	velx = -velx 
	posx = oldx
if velx < 0 then weight = weight + .1 end
 end
 if posy > 272 or  posy < 0 then 
	vely = -vely
        posy = oldy
if vely < 0 then weight = weight + .1 end
 end
 screen:blit(posx,posy,object)
if pad:r() then break end
screen.flip()

screen.waitVblankStart()
end
This way it does a really cool affect but I't not what he wanted
Code:
System.usbDiskModeActivate()
object = Image.load("tux.png")
 posx = 240
 posy = 136
 weight = 0.6
 velx = 1
 vely = 3 


while true do
screen:clear()
pad=Controls.read()
 White = Color.new(255,255,255)
 oldx = posx
 oldy = posy
 posx = posx - velx
 posy = posy - vely
 velx = velx - weight 
 vely = vely - weight
 if posx > 480 or posx < 0 then
	velx = -velx 
	posx = oldx
if velx < 0 then velx = velx + weight end
 end
 if posy > 272 or  posy < 0 then 
	vely = -vely
        posy = oldy
if vely < 0 then vely = vely + weight end
 end
 screen:blit(posx,posy,object)
if pad:r() then break end
screen.flip()

screen.waitVblankStart()
end
This way it speeds up but eventually stays at a constant rate and continues that way

@nataku92 - I dont really understand what you mean
xpack is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 07:22 PM   #9


Developer
 
Join Date: Jul 2006
Posts: 90
Trader Feedback: 0
Default

I basically meant what you did in your second example.
nataku92 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 07:24 PM   #10
 
xpack's Avatar
 
Join Date: Aug 2006
Location: Under Your Bed
Posts: 3,084
Trader Feedback: 0
Default

Yeah I thought that but all it does is speed up and stay at a constant rate of speed after a while.
xpack is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 07:44 PM   #11


Developer
 
Join Date: Jul 2006
Posts: 90
Trader Feedback: 0
Default

Bleh didn't look at your code closely enough. I meant add the weight if it's positive, and subtract it if it's positive:

Spoiler for code:

Code:
System.usbDiskModeActivate()
object = Image.load("tux.png")
 posx = 240
 posy = 136
 weight = 0.6
 velx = 1
 vely = 3 


while true do
screen:clear()
pad=Controls.read()
 White = Color.new(255,255,255)
 oldx = posx
 oldy = posy
 posx = posx - velx
 posy = posy - vely
 if velx > 0 then 
 	velx = velx - weight 
 	if velx < 0 then velx = 0 end
 end
 if vely > 0 then
 	vely = vely - weight 
 	if vely < 0 then vely = 0 end
 end
 if velx < 0 then 
 	velx = velx + weight 
 	if velx > 0 then velx = 0 end
 end
 if vely < 0 then
 	vely = vely + weight 
 	if vely > 0 then vely = 0 end
 end
 if posx > 480 or posx < 0 then
	velx = -velx 
	posx = oldx
 end
 if posy > 272 or  posy < 0 then 
	vely = -vely
        posy = oldy

 end
 screen:blit(posx,posy,object)
if pad:r() then break end
screen.flip()

screen.waitVblankStart()
end


Of course, acceleration might be a more suitable variable instead of weight.
nataku92 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 08:33 PM   #12
 
xpack's Avatar
 
Join Date: Aug 2006
Location: Under Your Bed
Posts: 3,084
Trader Feedback: 0
Default

This doesn't do anything it just shows up in place and goes up like 5 pixel then just stays in place
xpack is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 07-05-2007, 08:35 PM   #13


Developer
 
Join Date: Jul 2006
Posts: 90
Trader Feedback: 0
Default

And that means that it's slowing down...and stopping. Just make the starting velocities larger or the weight smaller (or both), and you'll it'll give better results.
nataku92 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
demo , wipluaphysics

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 10:31 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us