Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, Ayumi), 1,405 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A simple question #214456
07/04/08 17:40
07/04/08 17:40
Joined: Oct 2007
Posts: 27
S
Skeksis Offline OP
Newbie
Skeksis  Offline OP
Newbie
S

Joined: Oct 2007
Posts: 27
I'm currently working on a simple inventory, when viewing the inventory I want to be able to cycle through the items by pressing a or d. I can scroll the items by doing something like if (key_d == 1) { weapon1_ent.y += 5* time_step; }
the above code just scrolls it along the y axis for as long as I hold d, I only want it to scroll a certain distance though instead of scrolling infinitely. I hope that made sense, and I hope someone can help.

Re: A simple question [Re: Skeksis] #214465
07/04/08 18:42
07/04/08 18:42
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
hi you can achieve this using a loop.
Code:
 
function move_me()
{
var current_pos=0;
while(current_pos<=30){mypanel.pos_y+=1; current_pos+=1; wait(1);}
current_pos=0;
}


current_pos<=30 > 30 is the amount you want to move it.
mypanel.pos_y+=1 > 1 is the speed you want to move it.
mypanel.pos_y+=1 will change the panel's y direction. Use pos_x instead for the other direction.

You can then attach this to something like on_d=move_me; in main() or another function.

Last edited by DJBMASTER; 07/04/08 19:14.
Re: A simple question [Re: DJBMASTER] #214492
07/04/08 20:58
07/04/08 20:58
Joined: Oct 2007
Posts: 27
S
Skeksis Offline OP
Newbie
Skeksis  Offline OP
Newbie
S

Joined: Oct 2007
Posts: 27
Thank you for the help, it works perfectly.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1