Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / A Request for Help

Author
Message
iron programmer
16
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 27th May 2008 17:51
@IanM
Please don't lock this.

@The Rest of the Forum
I'm trying to create a puzzle game where when the character moves the enemy moves in the opposite direction. There are trees which the goblin cannot pass through. The goal is to get the goblin trapped in against a tree so the player can come up behind it press the spacekey to swing his sword to destroy it.

Here is the code I've got:

cls rgb(125,0,125)

load image "Male Character.bmp", 1
sprite 1, sprite1x, sprite1y, 1

load image "Male Character Attack Motion.bmp", 4
sprite 7, sprite1x, sprite1y, 4
hide sprite 7

sprite1x = 150
sprite1y = 150

load image "Goblin Enemy.bmp", 2
sprite 2, sprite2x, sprite2y, 2

sprite2x = 300
sprite2y = 300

load image "Tree (Rough).bmp", 3
sprite 3, tree1x, tree1y, 3
sprite 4, tree2x, tree2y, 3
sprite 5, tree3x, tree3y, 3
sprite 6, tree4x, tree4y, 3

tree1x = 100
tree1y = 100
tree2x = 200
tree2y = 100
tree3x = 400
tree3y = 200
tree4x = 100
tree4y = 400

main:
do
sprite 1, sprite1x, sprite1y, 1
sprite 7, sprite1x, sprite1y, 4
sprite 2, sprite2x, sprite2y, 2
sprite 3, tree1x, tree1y, 3
sprite 4, tree2x, tree2y, 3
sprite 5, tree3x, tree3y, 3
sprite 6, tree4x, tree4y, 3
if 1 = upkey() then sprite1y = sprite1y -10
if 1 = downkey() then sprite1y = sprite1y +10
if 1 = leftkey() then sprite1x = sprite1x -10
if 1 = rightkey() then sprite1x = sprite1x +10
if 1 = spacekey() then gosub playerattack
if 1 = upkey() then sprite2y = sprite2y +10
if 1 = downkey() then sprite2y = sprite2y - 10
if 1 = leftkey() then sprite2x = sprite2x +10
if 1 = rightkey() then sprite2x = sprite2x -10
if sprite collision(2,3) = 1 then sprite2x = sprite2x - 10
if sprite collision(2,4) = 1 then sprite2x = sprite2x +10
if sprite collision(2,5) = 1 then sprite2y = sprite2y - 10
if sprite collision(2,6) = 1 then sprite2y = sprite2y +10
loop

playerattack:
hide sprite 1
show sprite 7
wait 250
if sprite collision(7,2) = 1
wait 250
hide sprite 7
show sprite 1
end
endif
hide sprite 7
show sprite 1
gosub main




Here are the sprites:

Attachments

Login to view attachments
iron programmer
16
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 27th May 2008 17:52
Here are the sprites:

Attachments

Login to view attachments
iron programmer
16
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 27th May 2008 17:55
Here is the player:

Attachments

Login to view attachments
iron programmer
16
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 27th May 2008 17:55
Here is the player's attack:

Attachments

Login to view attachments
Beast E Gargoyle
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Sunny San Diego, CA
Posted: 27th May 2008 18:16
@iron programmer- I can see u are a new forum member. So I will kindly tell you that this kind of post is shunned on. You need screenshots to post in the WIP board. You also need alot more coding than what you have; to make any kind of puzzle game. My best advice to you is do some tutorials and than make a simple game on up to a puzzle game.

ALl the best,

Beastegargoyle

Streets of Rage the best 3d beat em up ever check out the wip on apollo forums!
The Last Great Swordsmen Wip here http://forum.thegamecreators.com/?m=forum_view&t=124414&b=19
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 27th May 2008 18:20
Also, a request for help would be better suited to the Newcomers Board.

That said, although the title of the post is 'A request for help', I can't actually see what it is that you want help with. You haven't asked any questions.



iron programmer
16
Years of Service
User Offline
Joined: 10th May 2008
Location: payying taxz to mi keety? (paying taxes)
Posted: 27th May 2008 18:25
@Beast E Gargoyle
I'm sorry. I'll move it.
This is a prototype, not a lot of code.

@Scraggle
I'm sorry. I'll move it.
The thing I need help with is whenever the player presses an arrow key, the enemy and the character disappear.
Mr Kohlenstoff
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 28th May 2008 01:03
Even though that's not the sense of a WIP (which you seemed to have realized)... you might try using "sync rate 30" or so at the beginning of your code. I did not try it, but for me it looks as if the game just runs so fast that your sprites leave the screen before you are able to release the move-key. You should also reduce this movement-stepsize, because moving your sprites by 10 will probably look strange. However.. good luck, keep it up, and don't post threads which are probably going to be locked again.

tha_rami
18
Years of Service
User Offline
Joined: 25th Mar 2006
Location: Netherlands
Posted: 28th May 2008 01:07
Well, that's a nice idea for sure.

If anything, I'd put the opposing movements in one large if-then statement.

Like this:


Maybe it's repeatingly registering you pressing the button? Try adding a wait key command at the end of those if-then statements. That'll cause you to have to press Enter after each move, to see if that helps.



That's not the final solution (if its a solution at all), though. I'll leave that one up to you.


A mod has been erased by your signature because it was larger than 600x120

Login to post a reply

Server time is: 2024-11-15 18:00:46
Your offset time is: 2024-11-15 18:00:46