Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
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
1 registered members (AndrewAMD), 1,225 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19056 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How can I code a simple player? #231997
10/18/08 17:50
10/18/08 17:50
Joined: Oct 2008
Posts: 58
Marc_Gagne Offline OP
Junior Member
Marc_Gagne  Offline OP
Junior Member

Joined: Oct 2008
Posts: 58
Hello, my name is Marc and I am new to Lite-C programming.
I was wondering if anyone could tell me how to code a simple player : a butterfly with 4 animation frames that can move forward and backward, and turn toward the left and the right.
It's just a game in which this butterfly wanders about, exploring, so no need for weapons or anything.
I have tried the workshops but I don't understand the part on making entities move.
Please help me.
Marc
P.S: I have tried the pre-written scripts: they are not what I want.

Re: How can I code a simple player? [Re: Marc_Gagne] #232106
10/19/08 14:54
10/19/08 14:54
Joined: Oct 2008
Posts: 58
Marc_Gagne Offline OP
Junior Member
Marc_Gagne  Offline OP
Junior Member

Joined: Oct 2008
Posts: 58
Anybody who can help?


"Chaos. War. Death. This is what I see."
Raistlin Majere
Re: How can I code a simple player? [Re: Marc_Gagne] #232107
10/19/08 15:01
10/19/08 15:01
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
if you dont understand the part of how to move entities then you should go back and learn that and after that you'll know how to create that butterfly movement by yourself.
first complete lite-c workshop and after you have completed it and LEARNED it then move on smile



Ubi bene, ibi Patria.
Re: How can I code a simple player? [Re: croman] #232110
10/19/08 15:21
10/19/08 15:21
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
#include <acknex.h>
#include <default.c>


action buterfly()
{
var anim_percentage;
player = my;
while (1)
{
c_move (my, vector(20 * (key_w - key_s) * time_step, 0 , 0), nullvector, IGNORE_PASSABLE | GLIDE);
/////the final 0 in the above c_move instruction is set to 0 for no gravity , if you create it in the air it will stay in the air
/////if you want gravity pulling the butterfly down change it to -1 or lower
my.pan -= 6 * mouse_force.x * time_step;
my.pan +=10 * (key_a - key_d)* time_step;
camera.x=my.x-200*cos(my.pan);
camera.y=my.y-200*sin(my.pan);
camera.z=my.z+100;
camera.tilt=-10;
camera.pan=my.pan;

ent_animate(my, "fly", anim_percentage, ANM_CYCLE);// the butterfly will animate its fly all the time , use your frame name for fly
anim_percentage += 6 * time_step; // "6" controls the animation speed

wait (1);
}
}

function main()
{
video_mode = 7;
video_screen = 1;
sound_vol = 100;
level_load("your level here");
wait(4);
player=ent_create("butterfly.mdl",vector(0,0,200),buterfly);
}


here should be all you need to load a level with your butterfly
model and control it with wasd it will always run its fly animating rename fly to your frame name

Re: How can I code a simple player? [Re: badapple] #232113
10/19/08 15:29
10/19/08 15:29
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
badapple, this is like you solved him a school test inside of class. he needs to learn it by himself otherwise...



Ubi bene, ibi Patria.
Re: How can I code a simple player? [Re: badapple] #232121
10/19/08 16:03
10/19/08 16:03
Joined: Oct 2008
Posts: 58
Marc_Gagne Offline OP
Junior Member
Marc_Gagne  Offline OP
Junior Member

Joined: Oct 2008
Posts: 58
Thank you badapple.


"Chaos. War. Death. This is what I see."
Raistlin Majere
Re: How can I code a simple player? [Re: Marc_Gagne] #232141
10/19/08 17:54
10/19/08 17:54
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
@cerberi_croman .... if you do not want help , there is nothing wrong with that , but dont critisize someone else because they do , i tried to comment out the code to help him
in the learning process not to cheat on a test.

@marc
no problem

Re: How can I code a simple player? [Re: badapple] #232146
10/19/08 18:14
10/19/08 18:14
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
smile sorry bout that, i didn't mean anything wrong. i just wanted to say that he could learn better if he learns by himself. if he is stuck on something he should go back on the beggining of that lection and read it again.

i was thought that it is the best way of learning. you helped him, bravo for you, i have nothing against that, but i just tried on sarcastic way to make a joke - unsuccesfull smile

i wanted him to try to create code for that by himself and if it doesn't work then to ask us for help. isn't that a better way to learn something? try to create it on your own, trust me, you'll learn it better and quicker smile



Ubi bene, ibi Patria.
Re: How can I code a simple player? [Re: croman] #232147
10/19/08 18:25
10/19/08 18:25
Joined: Apr 2006
Posts: 624
DEEP 13
badapple Offline
User
badapple  Offline
User

Joined: Apr 2006
Posts: 624
DEEP 13
@cerberi_crowman .. no problem , btw your ground tactics game looks very cool so far , the concept art and music , but i cant find any real screen shots , id like to see some screens of it

ps since marc has been helped i geuss its ok that we hijack his thread lol smile

Re: How can I code a simple player? [Re: badapple] #232164
10/19/08 20:42
10/19/08 20:42
Joined: Nov 2007
Posts: 1,032
Croatia
croman Offline
Serious User
croman  Offline
Serious User

Joined: Nov 2007
Posts: 1,032
Croatia
hehe, well first of all, it's not my game smile. i'm a developer in that team. game is in an early fase of development and so the screenshots will not yet be revealed.



Ubi bene, ibi Patria.

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