DSLua Community
Welcome,
Guest
. Please
login
or
register
.
May 21, 2012, 09:07:04 PM
1371
Posts in
262
Topics by
33109
Members
Latest Member:
Limewire Download
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 1629 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: 68
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