Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Akow, degenerate_762), 1,430 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19055 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
A newbie searching for help. Moving a player. #216637
07/18/08 00:35
07/18/08 00:35
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
Hello everyone.

I'm new to any kind of coding and such, and I've been browsing this forum for a while now.

So far, after a couple of days reading around, being on in my spare time, I stumbled upon a problem. I created something that looks kinda a 2d platform game, in its very early stage. What I have problem with now is to stop the player from moving, in any kind of direction.

I used this:

action move_left1()
{
while (!key_k) wait(1);
while (1)
{
if (key_k) Player2.y -= 1 * time_step;
else Player2.y = 0 * time_step;
wait (1);
}
}



well, thats about it for now.
Thanks for reading.

-Harstad-



Last edited by Harstad; 07/18/08 00:56.
Re: A newbie searching for help. Moving a player. [Re: Harstad] #216638
07/18/08 00:59
07/18/08 00:59
Joined: Jul 2008
Posts: 26
Norway
H
Harstad Offline OP
Newbie
Harstad  Offline OP
Newbie
H

Joined: Jul 2008
Posts: 26
Norway
After some thought, I found a solution to this, but there are still some problems:P

I changed the code to this:
if (key_k) Player2.y -= 5 * time_step;
else Player2.y += 5 * time_step;

The problem this time is, if I press k once and then let it go, and then again pressing k I get more and more speed. Everytime I hit the key he adds more speed to him.

Re: A newbie searching for help. Moving a player. [Re: Harstad] #216662
07/18/08 08:33
07/18/08 08:33
Joined: Aug 2003
Posts: 7,439
Red Dwarf
Michael_Schwarz Offline
Senior Expert
Michael_Schwarz  Offline
Senior Expert

Joined: Aug 2003
Posts: 7,439
Red Dwarf
maybe this helps a bit, you just have to opt out one of the dimensions wink

http://3dgsnerd.xware-cg.com/code-snippet-1/


"Sometimes JCL reminds me of Notch, but more competent" ~ Kiyaku
Re: A newbie searching for help. Moving a player. [Re: Michael_Schwarz] #216665
07/18/08 08:41
07/18/08 08:41
Joined: Apr 2005
Posts: 3,076
Germany, NRW
rvL_eXile Offline

3D Artist
rvL_eXile  Offline

3D Artist

Joined: Apr 2005
Posts: 3,076
Germany, NRW
Or Maybe try my Code (Player Movement with animation / Sounds)

http://rvlexile.wordpress.com/category/contributions/scripts/

cYa Sebastian


Tutorials:
[Blender]Terrain creation ENG/GER
[Blender]Low Poly Tree Modeling
[GIMP]Create a Texture for Terrains
CLICK HERE



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