Log In  
Follow
vldrake
[ :: Read More :: ]

Cart #zorahiwume-0 | 2019-11-14 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#69893 2019-11-14 15:40

[ :: Read More :: ]

Here is my code so far. I am trying to get the fish on the screen to move in an upward motion by itself, after I can master this I am going to try to do a collision detection for if the frog touches the fish = game over. Can anyone give me pointers on making the fish move by itself? Thank you

function _update()
fish_sprite+=18
if fish_sprite > 19 then
fish_sprite=18
end

char_sprite+=1
if char_sprite > 9 then
char_sprite=1
end

if btn(0) then char_x=char_x-1 sfx(05) end
if btn(1) then char_x=char_x+1 sfx(05) end
if btn(2) then char_y=char_y-1 sfx(05) end
if btn(3) then char_y=char_y+1 sfx(05) end
end

fish_sprite+=18
if fish_sprite > 19 then
char_sprite=18
end

function _draw()
cls()
map(0,0)
spr( char_sprite, char_x, char_y)
spr( fish_sprite, fish_x, fish_y)

print( time())
end

P#69205 2019-10-23 17:36

[ :: Read More :: ]

Cart #mukurupiju-0 | 2019-10-06 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#68550 2019-10-06 00:35

[ :: Read More :: ]

I keep trying to upload my cart and it keeps telling me invalid cart. I have done the F7 and saved it but every time I choose the file it tells me it is invalid. Please help

P#68547 2019-10-05 22:58

[ :: Read More :: ]

I am trying to do a simple game of pong for class and am having trouble. I have got the ball and the paddle. Now I am having trouble making the 2 collide. I am trying to get the ball to turn a different color when collided with the paddle.
I am also having trouble coding to get my paddle to stop when it hits the end of the screen so it does not disappear. Any advice would be much appreciated. I have attached my code so far that I have been working on. Thank you

ball_x = 3
x_speed = 1
ball_y = 15
y_speed = 1
ball_round = 3
col = 7
x=1
x1=5
y=127
y1=1
speed=5

function _init()
cls()
end

function _update()
buttpress = false

if btn(0) then speed =-5 end
if btn(1) then speed+=5 end
if not (buttpress) then
speed = speed/1.7
end
x+=speed

ball_y = ball_y+y_speed
ball_x = ball_x+x_speed

if ball_x > 127
then x_speed = -2
end

if ball_x < 0
then x_speed = 2
end

if ball_y > 127
then y_speed = -2
end

if ball_y < 0
then y_speed = 2
end

end

function _draw()
cls()
circfill(ball_x,ball_y,ball_round,col)
rect( x, y, x+8, y+1, 8)
end

P#67908 2019-09-19 20:20 ( Edited 2019-09-19 20:21)

[ :: Read More :: ]

I have got a rectangle drawn on the screen but need help. When I move it left to right it gets bigger. I want it to stay the same size and just move. Can someone please help me with my code

x=1
x1=5
y=2
y1=2
speed=2

function _init()
cls()
end

function _update60()
if btn(0) then x=x-speed end
if btn(1) then x=x+speed end
end

function _draw()
cls()
rect(x,y,x1,y1,8)
end

P#67603 2019-09-12 22:20

[ :: Read More :: ]

I have an assignment where I have to make a ball move and make a paddle move. I cannot move onto the next step because I can't seem to get the paddle to move when i press the buttons. Any help would be appreciated. Here is what I have for a code so far.

ball_x = 3
x_speed = 1
ball_y = 15
y_speed = 1
ball_round = 3
col = 0

pad_x = 52
pad_y = 120
pad_dx = 0
pad_w = 24
pad_h = 3
pad_c = 7

function _init()
cls()
end

function _update()
ball_y = ball_y+y_speed
ball_x = ball_x+x_speed
col=col+1

pad_y = pad_y+pad_dx
pad_x = pad_x+pad_dx
pad_c=pad_c+1

buttpress = false

if btn(0)
then pad_dx =-5
end
if btn(1)
then pad_dx+=5
end
if not (buttpress) then
pad_dx = pad_dx/1.7
end
pad_x+=pad_dx

if ball_x > 127
then x_speed = -2
end

if ball_x < 0
then x_speed = 2
end

if ball_y > 127
then y_speed = -2
end

if ball_y < 0
then y_speed = 2
end
end

function _draw()
cls()
circfill(ball_x,ball_y,ball_round,col)
rectfill(30,10,3,8)
end

P#67598 2019-09-12 19:35

[ :: Read More :: ]

I have done a game code for a red ball that I can move in a line. I have figured out the code for that. However, I am stuck on making it change a color when it hits the end of the pico 8 screen. I have searched it online and have had no luck. Can anyone explain what I need to do to get the ball to change color? Thank you
Here is my code so far without changing the color.

col=0
function _init()
cls()
xpos = 64
ypos = 64
col = 8
size = 5
end

function _update60()
if (btn(0) and xpos > 0) xpos -= 1
if (btn(1) and xpos < 127) xpos += 1
end
if xpos < 33 then col = 5
end
function _draw()
cls()
circfill(xpos, ypos, size, col)
end

P#67310 2019-09-05 23:38

Follow Lexaloffle:          
Generated 2024-03-29 00:19:46 | 0.072s | Q:19