View Full Version : Soapoplanet Rpg
soapo
01-03-2005, 01:09 AM
Im having trubles with my RPG. I have a layer named Map and it has a movieclip with the map of the game in it and the map is a jpg image made in fireworks and it has these actions:
onClipEvent (load) {
movespeed = 3;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x-= movespeed;
}
if (Key.isDown(Key.LEFT)) {
_x+= movespeed;
}
if (Key.isDown(Key.UP)) {
_y+= movespeed;
}
if (Key.isDown(Key.DOWN)) {
_y-= movespeed;
}
}
I made another layer called Hero and it has the main charicter in it witch is a movieclip with the instance name hero with these actions:
onClipEvent (load) {
movespeed = 0;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
gotoAndStop(5);
_x += movespeed;
}
if (Key.isDown(Key.LEFT)) {
gotoAndStop(3);
_x -= movespeed;
}
if (Key.isDown(Key.UP)) {
gotoAndStop(1);
_y -= movespeed;
}
if (Key.isDown(Key.DOWN)) {
gotoAndStop(7);
_y += movespeed;
}
}
because I what the bg to move not the charicter. In the Map layer in the movieclip with the map in it i drew a square and made it into a movieclip that i will make transparent over an area that i dont want the charicter to walk over. I need a actionscript so the charicter wont walk over the the movieclip how do i do this.
If you want to see my game so far you can go to
http://www.soapoplanet.com/My%20Game.html
ive just skim read, hitTest seems the best thing, name the transparent square, i dunno wall? in the hero movie clip put this
onClipEvent (enterFrame) {
if (this.hitTest(_root.wall)) {
moveSpeed = 0;
} else {
moveSpeed = 3;
}
}
why is there code for moving in the hero? it doesnt actually move him does it?
soapo
01-03-2005, 12:12 PM
The charicter dosnt move though its the bg that moves and the charicter is centerd in the middle. So i probally need some code for the bg so when the charicter colides with the square movieclip the bg will stop moveing. I also put this code:
onClipEvent (enterFrame) {
if (this.hitTest(_root.wall)) {
moveSpeed = 0;
} else {
moveSpeed = 3;
}
}
in a differnt game to see if it worked but when it walked in to some thing it would stop but if you try to go some were elce it would stay stoped.
moonm325
01-03-2005, 12:59 PM
hey soapo, I went to your site, and you have xgen's games on there, and you have no mention of xgne on your site. Either take them down on mention xgen on there, please. What you are doing is illegal.
DarkReality
01-03-2005, 01:21 PM
You made that image? Not bad. But in order for a hittest to work, you can't import an entire map. The things you want your character to "hit" and not move over need to be separate objects. However, turning your game into a tilebased one seems like the right idea.
oos.moxiecode.com has a good tilebased tutorial. It'll be quite a bit of work to turn your map into tiles, but it'll be worth it. It makes hittests so much easier.
And increase the framerate on your main flash file. It looks choppy and it ain't my computer :-)
soapo
01-03-2005, 01:32 PM
moonm325 i do have mention of xgen studios its on my link page under credits.
denacioust
01-03-2005, 01:33 PM
onClipEvent (enterFrame) {
if (this.hitTest(_root.wall.boundary)) {
moveSpeed = -1;
} else {
moveSpeed = 3;
}
}
Try it like that
soapo
01-03-2005, 01:34 PM
How do i make this one work so he can move after he colides because with this code once he hits a movieclip with this code he cant move anymore:
onClipEvent (enterFrame) {
if (this.hitTest(_root.wall)) {
moveSpeed = 0;
} else {
moveSpeed = 3;
}
}
Freddy
01-03-2005, 01:45 PM
he cant move anymore because move is set to 0 when he touches it. that means he cant move in any direction.
I usualy make like moveSpeedLeft, moveSpeedRight, moveSpeedUp, moveSpeedDown, and change each individual value to what I want it.
and btw, the bakcground was taken from Pokemon. At least some of it was. I recodnise those grass and trees a mile away.
soapo
01-03-2005, 01:45 PM
OK i tried:
onClipEvent (enterFrame) {
if (this.hitTest(_root.wall)) {
moveSpeed = -1;
} else {
moveSpeed = 3;
}
}
It works but if you quikly change your direction to the oposite side of the wall it suckes you into the wall
moonm325
01-03-2005, 01:47 PM
moonm325 i do have mention of xgen studios its on my link page under credits.Yes, but that still doesn't give you permission to have it on your site. You need to either.A) Link to the game on xgen, or
B) Get a license from Skye J. W. Bowes to use it on your site and put who made the game.Thank you.
soapo
01-03-2005, 01:51 PM
Actually i did use the link from xgen studios so it is not really on my site and you are allowed to put someone elsees stuff on your page if you leave credit. And i did use the sprites from pokemon to build my own map if any body wants them email me at soapoplanet@hotmail.com.
soapo
01-03-2005, 01:56 PM
OK i tried:
onClipEvent (enterFrame) {
if (this.hitTest(_root.wall)) {
moveSpeed = -1;
} else {
moveSpeed = 3;
}
}
It works but if you quikly change your direction to the oposite side of the wall it suckes you into the wall
moonm325
01-03-2005, 02:06 PM
Actually i did use the link from xgen studios so it is not really on my site and you are allowed to put someone elsees stuff on your page if you leave credit. And i did use the sprites from pokemon to build my own map if any body wants them email me at soapoplanet@hotmail.com.What I mean is to use http://www.xgenstudios.com/play/castle/, that way it goes to xgen's site.
And I would like to see the license from Skye.
soapo
01-03-2005, 02:09 PM
look not on my site on his site.
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="100%" height="90%">
<param name="movie" value="http://www.xgenstudios.com/castle/castle.swf">
<param name="quality" value="high">
<embed src="http://www.xgenstudios.com/castle/castle.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="100%" height="90%">
</embed></object>
soapo
01-03-2005, 02:10 PM
OK i tried:
onClipEvent (enterFrame) {
if (this.hitTest(_root.wall)) {
moveSpeed = -1;
} else {
moveSpeed = 3;
}
}
It works but if you quikly change your direction to the oposite side of the wall it suckes you into the wall
illrainman
01-03-2005, 03:08 PM
It would take more time to set up and use, but you could make a movieclip for each side of the wall or whatever and when the character is hit by those, change the _x or _y values of the map to place the character far enough away from the wall so he doesn't get stuck. Thats the long way, but the only way I can think of to guarantee the character doesn't get stuck. Or you can use the moveSpeedX and moveSpeedY idea from Shadow.
And you need to link to the actual html page of the game, not just put the swf on your page from what I understand.
denacioust
01-03-2005, 03:30 PM
Stop posting that soapo.
And how you could do it is set its position to its last position by using last. or something similar.
soapo
01-03-2005, 03:51 PM
How do you use last
The Brown Cow
01-03-2005, 05:18 PM
Store the current position before letting the player move. Then let the player move. If they collide with something, send them back.
var xlast = this._x;
var ylast = this._y;
//
// Input from player here.
//
if (collisionDetectionGoesHere) {
this._x = xlast;
this._y = ylast;
}
Make sense?
bobmasedo
01-03-2005, 06:40 PM
just a question, isnt getting games on your site worse like that because it takes up bandwidth?
The Brown Cow
01-04-2005, 09:11 AM
Yes, it's bandwidth stealing, and Skye has the legal right to sue for stealing his work.
Providing a link to the page containing the game (like this (http://www.xgenstudios.com/play/castle)) is legal and appreciated since it boosts pagerank in Google.
moonm325
01-05-2005, 06:58 PM
Thats what I was trying to tell him.
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.