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
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
1 registered members (henrybane), 1,499 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
another 2 problems #137797
06/24/07 09:31
06/24/07 09:31
Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
D
Disaster Offline OP
Member
Disaster  Offline OP
Member
D

Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
Hi
I have another 2 problems...
the first problem is that my enemy entitys don't move over the screen and the second problem is the collision with the player. nothing happens when i touch with my player an enemy. But when there are 30 enemys in the script (because they become more and more during the game) suddenly my player disappears like he should do after a collision with an enemy.
my code (mostly taken from the book of tobias runde; i know it's not up to date but nevertheless it helps sometimes ):

define speed, skill1;
define direction, skill2;
var distance[3];

action enemy
{
my.push = -1;
my.z = 32;
my.passable = on;
If (my.speed == 0)
{
my.speed = random(6)+3;
}
my.direction = 1;
my.pan += random(my.richtung)*time*my.direction;
distance.x = time*my.speed;
distance.y = 0;
distance.z = 0;
vec_set(temp,my.x);
if (vec_dist(my.x, player.x) < 35)
{
ent_remove(player);
}

}


action player
{

player = me;
my.enable_impact = on;
wait(1);
while(player != NULL)
{
my.push = -1;
...
}
}


mfg Disaster
Re: another 2 problems [Re: Disaster] #137798
06/24/07 10:25
06/24/07 10:25
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Code:


while(my)
{

If (my.speed == 0)
{
my.speed = random(6)+3;
}
my.direction = 1;
my.pan += random(my.richtung)*time*my.direction;
distance.x = time*my.speed;
distance.y = 0;
distance.z = 0;
vec_set(temp,my.x);
if (vec_dist(my.x, player.x) < 35)
{
ent_remove(player);
}

wait(1);
}


1) You have to put the above code (red color) in a while loop
to let them move continously.

2) You need an event function when player is collided by enemies,
for example :

Code:

player = me;
my.enable_impact = on;

my.event = hitme;

wait(1);
while(player != NULL)
{
my.push = -1;
...
}
function hitme() // put this function above your actions
{
if (event_type == event_impact)
{
.....
.....
}
}



Re: another 2 problems [Re: vlau] #137799
06/24/07 13:49
06/24/07 13:49
Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
D
Disaster Offline OP
Member
Disaster  Offline OP
Member
D

Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
hi
I put the red code in a while loop as you described it and i also wrote a simple event but the two problems are stioll there. the enemys don't move and the don't "kill" the player...


mfg Disaster
Re: another 2 problems [Re: Disaster] #137800
06/24/07 14:53
06/24/07 14:53
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Ah, I'm overlook this line : distance.x = time*my.speed;
change it to distance.x += time*my.speed, but then again it will move
forward only about the world axis, no matter what my.pan is facing, you
may need to use c_move instead, and in fact, the even_impact function won't
trigger without c_move.







Last edited by vlau; 06/24/07 14:58.
Re: another 2 problems [Re: vlau] #137801
06/24/07 15:26
06/24/07 15:26
Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
D
Disaster Offline OP
Member
Disaster  Offline OP
Member
D

Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
ok now they are moving^^ thank you
to the direction: i have a simple room and you play a ball who has to catch a cube. when you catch it one more enemy appears and "walks" along in this room and kills you when you hit it. so i think a movement only forwards is enough, because the enemys only have to change their move-directing when they hit a wall. I wanted to do this with "bounce" ...but i have no idea how to code this
i simply want to write a game like this in 3d: http://www.lewpen.com/game/
perhaps than it's easier to understand


mfg Disaster
Re: another 2 problems [Re: Disaster] #137802
06/24/07 15:50
06/24/07 15:50
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Oh interesting game I think writing games has a lot of fun and
if you can make it by yourself will be a big big fun, so I suggest
try it yourself, it won't be too difficult.

I'll say using c_move plus even_impact/event_entity for
your moveable entities is a good way to go.

Good luck!

Re: another 2 problems [Re: vlau] #137803
06/24/07 19:12
06/24/07 19:12
Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
D
Disaster Offline OP
Member
Disaster  Offline OP
Member
D

Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
hm...now they are moving to to the wall, but very very fast and sometimes they even bounce but only sometimes...the most time they are hanging in a corner.
Do you know a tutorial where bounce is explained, because i really have no idea who to use it...


mfg Disaster
Re: another 2 problems [Re: Disaster] #137804
06/24/07 21:29
06/24/07 21:29
Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
D
Disaster Offline OP
Member
Disaster  Offline OP
Member
D

Joined: Jul 2006
Posts: 111
Germany near Wuerzburg
ok now the code works nearly perfect.
But how can i prevent that the enemys bounce in z-direction? because sometimes they are flying out of my level. another little problem is the collision with the player because the programm even detects a collision when the two objects are close together but don't touch. how can i change this?


mfg Disaster
Re: another 2 problems [Re: Disaster] #137805
06/25/07 08:16
06/25/07 08:16
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Hello Disaster,

You can find a lot of tips about c_move and bounce in
Aum's faq list

Go there, press CTRL-F, and type "bounce".

Also try bounce.z = 0 to prevent bounce to z-axis, not tested btw.

Quote:


another little problem is the collision with the player because the programm even detects a collision when the two objects are close together but don't touch. how can i change this?





May be reset their bounding box using c_setminmax(my), put it into
the first line of your action :

action ballEntity
{
c_setminmax(my);
.....
.....
}

Last edited by vlau; 06/25/07 09:08.

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