Tuesday, 02 December 2008
Home
Forum
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome,
Guest
. Please
login
or
register
.
December 02, 2008, 09:19:38 AM
Username:
Password:
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Forgot your password?
Help with moving a sprite
DSLua Community
Welcome,
Guest
. Please
login
or
register
.
December 02, 2008, 09:19:38 AM
1723
Posts in
315
Topics by
6338
Members
Latest Member:
Driennaunmand
Home
Help
Search
Login
Register
DSLua Community
|
General DS Programming Chats
|
Code Hashing
|
Help with moving a sprite
« previous
next »
Pages:
[
1
]
Print
Author
Topic: Help with moving a sprite (Read 796 times)
Alexand3rS
New Moon
Posts: 3
Help with moving a sprite
«
on:
October 27, 2007, 03:37:43 PM »
Hi I am new to DSlua and I was wondering how to move a sprite (character picture) with the D pad around the screen...
Logged
sylus101
Waxing Crescent
Posts: 74
Re: Help with moving a sprite
«
Reply #1 on:
November 25, 2007, 01:05:33 AM »
There's going to be a lot of possibilities here... but for a simple example, you could just do a check if a Pad direction is held, then move the sprite by incrementing a variable that represents it's x or y position and move the sprite to the new position.
There's some stuff on this in the tutorials for sure. Without any of the other setup of loading the sprite into memory or anything, this would move a sprite Right 1 pixel every VBlank, or 60 pixels per second. I'm sure you could figure out the other directions.
x = 50
y = 96
while 1 == 1 do
if Pads.Right() then
x = x + 1
sprite.MoveTo(x,y)
end
DSLuaWaitForVBlank()
end
«
Last Edit: November 25, 2007, 01:14:29 AM by sylus101
»
Logged
Pages:
[
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
DSLua - Best scripting language for Nintendo DS
-----------------------------
=> News and Announcements
=> Examples/Tutorials
=> Home-brew/Hacks/Games/Projects
=> Hardware and Equipments
=> Need Help?
=> Bugs & Suggestions
-----------------------------
General DS Programming Chats
-----------------------------
=> Code Hashing
=> Chat Room
=> Test Area
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media
(C) 2008 DSLua
DSLua - Best scripting language for Nintendo DS home-brew!