|
-
Senior Member
[HELP] On A Robot Game
I am in the early stage of making a robot game... (NOTE: im new at flash)
and can seem to get these things to work
what are the numbers decaliring in this
if(_root.Player._x+30>_x && _root.Player._x-30<_x &&
_root.Player._y+30>_y && _root.Player._y-30<_y)
also i am trying to make a box that when the player moves up agaist the block moves with the player this is what i got but... i can only move it sideways not ups have i forgotten sumthing??
onClipEvent (load) {
force_x=5;
}
onClipEvent (enterFrame) {
update=0;
if(this.hitTest(_root.Player._x-3,
_root.Player._y+_root.Player._height/2,true)) {
while(this.hitTest(_root.Player._x-3,
_root.Player._y+_root.Player._height/2,true)) {
_x-=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h+3,
_root.Player._y+_root.Player._height/2,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth+3,
_root.Player._y+_root.Player._height/2,true)) {
_x+=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
_root.Player._y,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
_root.Player._y,true)) {
_y-=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
_root.Player._y+_root.Player._height,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
_root.Player._y+_root.Player._height,true)) {
_y+=1;
}
update=1;
}
if(update==1) {
while(_root.Level.hitTest(_x,
_y+_height/2+2,true)) {
_y-=1;
}
while(_root.Level.hitTest(_x,
_y-_height/2-2,true)) {
_y+=1;
}
while(_root.Level.hitTest(_x-_width/2-2,
_y,true)) {
_x+=1;
}
while(_root.Level.hitTest(_x+_width/2+2,
_y,true)) {
_x-=1;
}
}
IS THERE AN EASER WAY !!!!!!!!!!!!!!!!!
Last edited by Gloo pot; 08-22-2005 at 08:03 AM.
-
Style Through Simplicity
Use the [ CODE] [ /CODE] tags (without spaces) to make your code more readable. i dont feel like reading through it all like that.
Are the [ as] tags back yet?
Ali
-
my x booty it is that BIG
Code:
onClipEvent (load) {
force_x=5;
}
onClipEvent (enterFrame) {
update=0;
if(this.hitTest(_root.Player._x-3,
_root.Player._y+_root.Player._height/2,true)) {
while(this.hitTest(_root.Player._x-3,
_root.Player._y+_root.Player._height/2,true)) {
_x-=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h+3,
_root.Player._y+_root.Player._height/2,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth+3,
_root.Player._y+_root.Player._height/2,true)) {
_x+=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
_root.Player._y,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
_root.Player._y,true)) {
_y-=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
_root.Player._y+_root.Player._height,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
_root.Player._y+_root.Player._height,true)) {
_y+=1;
}
update=1;
}
if(update==1) {
while(_root.Level.hitTest(_x,
_y+_height/2+2,true)) {
_y-=1;
}
while(_root.Level.hitTest(_x,
_y-_height/2-2,true)) {
_y+=1;
}
while(_root.Level.hitTest(_x-_width/2-2,
_y,true)) {
_x+=1;
}
while(_root.Level.hitTest(_x+_width/2+2,
_y,true)) {
_x-=1;
}
}
there you go i did you the favor
Project||[GAME]-on hold for now
------------------
[Hero]-80%
[Enemies]-1%
[Weapons]-90%
[Items]-0%
[Levels]-10%
-
Official Shoe Shiner
code:
onClipEvent (load) {
force_x=5;
}
onClipEvent (enterFrame) {
update=0;
if(this.hitTest(_root.Player._x-3,
_root.Player._y+_root.Player._height/2,true)) {
while(this.hitTest(_root.Player._x-3,
_root.Player._y+_root.Player._height/2,true)) {
_x-=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h+3,
_root.Player._y+_root.Player._height/2,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth+3,
_root.Player._y+_root.Player._height/2,true)) {
_x+=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
_root.Player._y,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
_root.Player._y,true)) {
_y-=1;
}
update=1;
}
if(this.hitTest(_root.Player._x+_root.Player._widt h/2,
_root.Player._y+_root.Player._height,true)) {
while(this.hitTest(_root.Player._x+_root.Player._w idth/2,
_root.Player._y+_root.Player._height,true)) {
_y+=1;
}
update=1;
}
if(update==1) {
while(_root.Level.hitTest(_x,
_y+_height/2+2,true)) {
_y-=1;
}
while(_root.Level.hitTest(_x,
_y-_height/2-2,true)) {
_y+=1;
}
while(_root.Level.hitTest(_x-_width/2-2,
_y,true)) {
_x+=1;
}
while(_root.Level.hitTest(_x+_width/2+2,
_y,true)) {
_x-=1;
}
}
even nicer ...that was with the as tags....there doesnt seem to be much difference apart from the colou and font...
Message on a gravestone: I finished before you in the human race.
Using: Flash MX
-
Style Through Simplicity
Yea, but it used to say action script at the top! i want that back!!!! 
Ali
-
Senior Member
ok sry.. i tryed like 50 diferenct things and i cant get it to work... can some 1 plz write me a code for a movable block EG: when the hero moves into it the block move with the hero...
the moveable block is called "box" and the hero is called "player"
oh prety please n e 1
-
n00b
/\/\41I33 y0[_] 540(_)1d \/\/r1t3 1/\/ pr0p3r 3/\/gl15h!
4150, h0\/\/ d1d y0u \/\/r1t3 411 th4t c0d3 \/\/1th0ut 3v3n I</\/0\/\/1ng \/\/h4t 50/\/\3 0I= th3 I\I(_)/\/\I3b3r5 /\/\34/\/?
I do stuff that does stuff...
J-Force
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|